Write a C program using a union to store an integer and a float alternately, demonstrating shared memory allocation.
An integer value followed by a float value.
Print both values when assigned sequentially.
-100000 <= IntVal <= 100000, 0.0 <= FloatVal <= 100000.0
10 5.5
Integer: 10 Float: 5.50
Demonstrates union member assignment and shared storage behavior.
#include <stdio.h>
union Data {
int i;
float f;
};
int main() {
union Data data;
int val_i;
float val_f;
if (scanf("%d %f", &val_i, &val_f) == 2) {
// Write your code here
}
return 0;
}Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used