Can a variable be both static and volatile in c?



Can a variable be both static and volatile in c?..

Answer / Pritam Prag

Yes, a variable can be both static and volatile in C. When a variable is declared as both static and volatile, it will retain its value between function calls (as with a static variable) but the compiler will not optimize reads or writes to the variable (as with a volatile variable).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Differentiate between a for loop and a while loop? What are it uses?

1 Answers   TISL,


can i know the source code for reversing a linked list with out using a temporary variable?

6 Answers   Honeywell,


write a program fibonacci series and palindrome program in c

1 Answers   Aditi Placement Service,


How can I do peek and poke in c?

1 Answers  


What is line in c preprocessor?

1 Answers  


What 'lex' does?

1 Answers   Tech Mahindra,


Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

1 Answers   Amazon,


WHAT IS THE DIFFERENCE BETWEEN malloc() and calloc() in c file management?

28 Answers   3D PLM, Code Studio, Deltech, IBM,


code for selection sort?

1 Answers  


How to avoid buffer overflow?

1 Answers  


declare afunction pointer to int printf(char *)?

1 Answers   HCL,


What is the process to generate random numbers in c programming language?

1 Answers  


Categories