c volatile keyword code example
Example 1: declaring a volatile in c
#include<stdio.h>
int main(){
int volatile number1 = 10;
volatile int number2;
number2 = 20;
int volatile *p1;
p1 = &number1;
volatile int **p2;
p2 = &p1;
printf("%d %d %d %d",number1,number2,*p1,**p2);
return 0;
}
Example 2: volatile keyword in c
C's volatile keyword is a qualifier that is applied to a variable when it is declared. It tells the compiler that the value of the variable may change at any time--without any action being taken by the code the compiler finds nearby.