Answer Posted / chandrashekar kalvacherla
volatile tells the compiler that this variable can get altered by ways that the compiler cannot deduce. As a consequence, the compiler will exclude that variable from optimizations and the code will always fetch the variables content from memory, even if it has done so before (no caching).
Imagine a hardware clock which is mapped into memory. You need some way to tell the compiler: whenever I access that variable (mapped to the hardware clock), I want you to actually fetch the content from there. Otherwise the compiler might just ask the clock once for the current time and use the cached value (in a processor register) throught the rest of the program.
Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
With the help of using classes, write a program to add two numbers.
Is printf a keyword?
Why is sprintf unsafe?
You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.
How many keywords are there in c?
What are the different types of C instructions?
What is strcpy() function?
How important is structure in life?
Hai what is the different types of versions and their differences
What language is c written?
Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop
What are the ways to a null pointer can use in c programming language?
Explain the use of keyword 'register' with respect to variables.
What is the advantage of a random access file?
Why do we use stdio h and conio h?