Embedded C Interview Questions and Answers
Ques 6. How does dynamic memory allocation differ in embedded systems compared to desktop applications?
Embedded systems often avoid dynamic memory allocation due to limited resources and potential fragmentation issues.
Ques 7. What is the purpose of the 'volatile' keyword in C?
The 'volatile' keyword is used to indicate that a variable may be changed by external factors, such as an interrupt service routine.
Example:
volatile int flag;
Ques 8. Explain the role of a linker script in embedded C programming.
A linker script defines the memory layout of an embedded system, specifying the placement of code and data in the target memory.
Ques 9. What is bit masking, and how is it used in embedded C?
Bit masking involves setting or clearing specific bits in a variable to enable or disable certain features, often used in register manipulation.
Example:
#define ENABLE_BIT (1 << 3) // Enable bit 3
Ques 10. Explain the concept of polling in embedded systems.
Polling involves regularly checking the status of a device or condition within the code, often used for input or communication handling.
Most helpful rated by users:
- What is embedded C?
- What is a volatile variable in C?
- Explain the significance of the 'const' keyword in embedded C.
- What is the purpose of the 'volatile' keyword in C?
- Explain the concept of polling in embedded systems.