C_Programming_Questions_Answers_Part1
C_Programming_Questions_Answers_Part1
---
---
---
---
---
---
---
---
---
---
---
---
---
---
## **15. How is a structure different from an array in C?**
1. **Array**: Stores multiple values of the same type.
2. **Structure**: Stores multiple values of different types.
Example:
```c
#include <stdio.h>
struct Student {
int id;
char name[50];
};
int main() {
struct Student student1 = {1, "Alice"};
printf("ID: %d, Name: %s\n", student1.id, student1.name);
return 0;
}
```
---