Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is volatile in c language?

Answers were Sorted based on User's Feedback



what is volatile in c language?..

Answer / selvakumar vedhachalam

It is nothing but telling to compiler that this variable
will change its value at anytime by means of anything and
compiler should not make any assumption about this variable.

Normally compiler will assume that some variable will be
constant during runtime. This may lead error in checking a
registor value repeatedly. Because the register value may
be changed by anything. So for these kind of variables
should be declared 'volatile' and it be checked each time
appears in the code with out any assumption.

Is This Answer Correct ?    135 Yes 11 No

what is volatile in c language?..

Answer / hareesha chikkapattanager parv

It is nothing but telling to compiler that this variable
will change its value at anytime by hard or outside the
controll of the program and compiler should not make any
assumption or optimize about this variable.

Is This Answer Correct ?    46 Yes 5 No

what is volatile in c language?..

Answer / deep

consider this outside main()

int i=10;
int j = i + 10;

here smart compilers always replace the i in the second
statement with 10, when we use volatile keyword this will be
avoided and always there is a check of the i variable ,
before initialising it..
So the optimisation here is avoided

Is This Answer Correct ?    15 Yes 2 No

what is volatile in c language?..

Answer / bhagyaraj m c

Both 1 and 2 comments are correct.
Just simplifying this
"Recompute\Refresh every time when ever the volatile is
found."

Is This Answer Correct ?    19 Yes 7 No

what is volatile in c language?..

Answer / sudeep

It is nothing but telling to compiler that this variable
will change its value at anytime by means of anything and
compiler should not make any assumption about this variable.

Is This Answer Correct ?    11 Yes 0 No

what is volatile in c language?..

Answer / s.m.faisal

volatile reduces the optimization .optimization means compiler should not make out that the variable has not changed its value so it reads the value directly from the register.
So while using volatile keyword compiler will directly access the variable from the memory not from the register bcz the value of the variable can be changed outside or inside the program.

Is This Answer Correct ?    2 Yes 0 No

what is volatile in c language?..

Answer / lingaraj a

The programmer just give inform to compiler the value of
variable will change at any time without any action being by
program. The change will be made by hardware or external source.

Is This Answer Correct ?    6 Yes 5 No

what is volatile in c language?..

Answer / justin arokiaraj.r

Volatile is used for direct memory access.it can be updated by both hardware and software .so unused volatile will not be optimized in compilation
.

Is This Answer Correct ?    1 Yes 0 No

what is volatile in c language?..

Answer / greg

Volatile is a storage class that indicates that the
compiler should not perform any optimization on the
variable.

Is This Answer Correct ?    4 Yes 8 No

Post New Answer

More C Interview Questions

Explain what does a function declared as pascal do differently?

0 Answers  


Can we change the value of constant variable in c?

0 Answers  


prog for 1st five prime numbers in 2^x - 1

0 Answers  


What is the value of y in the following code? x=7;y=0; if(x=6) y=7; else y=1;

12 Answers   TCS,


main() { printf("hello"); fork(); }

0 Answers   Wilco,


What is the purpose of void in c?

0 Answers  


Given an array of length N containing integers between 1 and N, determine if it contains any duplicates.

3 Answers   SilverKey,


what will the following program do? void main() { int i; char a[]="String"; char *p="New Sring"; char *Temp; Temp=a; a=malloc(strlen(p) + 1); strcpy(a,p); //Line no:9// p = malloc(strlen(Temp) + 1); strcpy(p,Temp); printf("(%s, %s)",a,p); free(p); free(a); } //Line no 15// a) Swap contents of p & a and print:(New string, string) b) Generate compilation error in line number 8 c) Generate compilation error in line number 5 d) Generate compilation error in line number 7 e) Generate compilation error in line number 1

1 Answers   IBM,


Why does the call char scanf work?

0 Answers  


What are the types of type qualifiers in c?

0 Answers  


explain how do you use macro?

0 Answers  


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

0 Answers  


Categories