From the course: C Programming for Embedded Applications
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
The volatile qualifier - C Tutorial
From the course: C Programming for Embedded Applications
The volatile qualifier
- [Instructor] The C programming language provides a few qualifiers to let the compiler know some important details about variables. So being specific about variables has an impact on memory and storage because qualifiers determine whether a variable will be stored in RAM or ROM. The hardware has access to some variables and the software can be made aware of this with qualifiers. Finally, this may have an effect on undesired compiler optimizations. Let's start with a thought experiment. Take a look at this Goethe. Notice that after assigning eight to the global variable, A, the, if statement compares A to eight, printing different messages for each case. Try to answer the following questions. First, what's the output of running this function? Is it A, a equals eight, B, a is not eight or C, it's not possible to tell, and second, is it possible to execute the else part? Yes or no? You may want to pause the video to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.