what is difference b/w extern & volatile variable??

Answer Posted / anonimos

volatile variables are used on RT Embedded systems to
interface a physical memory mapped/IO mapped cell on the
computer board (volatile pointer).

Example define IO port:
#define PortA (*(volatile unsigned char *)0x3b)
unsigned char inputValue=PortA;

optimization may attempt to perform paging to hard drive of
to cache or even CPU registers so when reading from the
physical location in Mem/IO space the program will actually
read old value that was paged/cached by optimization
algorithm of the computer/board, even after the Input
changed on this Memory/IO cell.

volatile instruct the compiler to prevent optimization by
caching to registers/cache.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain logical errors? Compare with syntax errors.

631


Are there namespaces in c?

570


What does p mean in physics?

586


What does s c mean on snapchat?

589


What is a string?

667






What is the sizeof () operator?

625


What are the disadvantages of c language?

622


Whats s or c mean?

594


What will the code below print when it is executed?   int x = 3, y = 4;         if (x = 4)                 y = 5;         else                 y = 2;         printf ("x=%d, y=%d ",x,y);

1358


How we can insert comments in a c program?

634


Why is main function so important?

618


In c programming language, how many parameters can be passed to a function ?

632


How can I write functions that take a variable number of arguments?

627


regarding pointers concept

1575


Not all reserved words are written in lowercase. TRUE or FALSE?

720