Embedded C Interview Questions and Answers
What is Embedded C?
Embedded C is an extension of the C programming language, optimized for programming embedded
systems like microcontrollers.
What is the difference between 'volatile' and 'const'?
'const' means the variable cannot be modified after initialization.
'volatile' tells the compiler the variable can change at any time.
Why is 'volatile' used in embedded systems?
To prevent the compiler from optimizing out accesses to variables that may be changed by interrupts or
hardware.
What is the use of 'static' keyword in C?
Inside functions: retains the value between calls.
At file level: limits scope to that file.
What is the difference between '#define' and 'const'?
'#define' is a preprocessor directive with no type checking.
'const' is type-safe and obeys scope rules.
What is a pointer?
A pointer is a variable that stores the memory address of another variable.
What is a NULL pointer?
Embedded C Interview Questions and Answers
A NULL pointer is a pointer that doesn't point to any memory location (value 0).
What is an ISR?
Interrupt Service Routine: a function executed in response to an interrupt. It has no return and no arguments.
Can we pass arguments to an ISR?
No. ISRs are called by hardware, not software.
What is a Watchdog Timer?
A timer that resets the system if the software hangs or becomes unresponsive.
What are memory segments in Embedded C?
Code, Data, BSS, Stack, Heap.
What are the types of memory in embedded systems?
ROM/Flash, RAM, EEPROM.
What is the difference between a function pointer and a regular pointer?
A function pointer points to a function and can be used to call functions dynamically.
What is bit masking?
Using bitwise operations to manipulate specific bits in a byte/register.
What happens during a system reset?
Embedded C Interview Questions and Answers
Processor resets, stack pointer initialized, program counter set, globals initialized.
What is the difference between polling and interrupt?
Polling: CPU constantly checks for condition.
Interrupt: CPU is notified asynchronously.