how the compiler treats any volatile variable?Explain with
example.
Answer / daniboy
A volatile variable is one whose VALUE CAN CHANGE
UNEXPECTEDLY. Consequently, the compiler can make NO
ASSUMPTIONS about the value of the variable. In
particular, the optimizer must be careful to RELOAD the
variable every time it is used instead of holding a copy in
a register.
Examples of volatile variables are:
(a) Hardware registers in peripherals (e.g., status
registers)
(b) Non-stack variables referenced within an interrupt
service routine.
(c) Variables shared by multiple tasks in a multi-
threaded application.
Source: 10 Best Questions to would-be Embedded Programmers -
By Nigel Johns
Is This Answer Correct ? | 6 Yes | 0 No |
When is an interface "good"?
When should you use a type cast?
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
Write a program to check prime number in c programming?
What is the code in while loop that returns the output of given code?
An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode
character array A[12] can hold
Write a program which has the following seven functions. The functions should be: • main() this calls the other 6 functions • fget_long() a function which returns a long data type from a file • fget_short() a function which returns a short integer variable from a file • fget_float() a function which returns a floating point variable from a file • fprt_long() a function which prints its single, long argument into a file • fprt_short() a function which prints its single, short argument into a file • fprt_float() a function which prints its single, floating point argument into a file. You should use fscanf() to get the values of the variables from the input (the file) and fprintf() to print the values to the other file. Pay attention to using the correct format for each of the data types.
What are qualifiers and modifiers c?
Can we assign integer value to char in c?
Is main is a keyword in c?
c pgm count no of lines , blanks, tabs in a para(File concept)