Array and String Library
Array and String Library
An **array** in C is a collection of elements of the same data type stored in contiguous memory
locations.
It allows you to store multiple values in a single variable, accessed using an index.
1. **Homogeneous Elements**: All elements in an array are of the same data type.
3. **Fixed Size**: The size of an array must be specified during its declaration and cannot be
changed.
---
Nested structures are structures that contain one or more structures as members. They allow
#### Example
```c
#include <stdio.h>
struct Address {
char city[50];
int pincode;
};
struct Person {
char name[50];
int age;
};
int main() {
return 0;
```
---
Multidimensional arrays are arrays of arrays. The most common is the **two-dimensional array**,
#### Syntax:
```c
data_type array_name[size1][size2];
```
#### Example:
```c
#include <stdio.h>
int main() {
printf("\n");
return 0;
```
---
### Strings in C
Strings in C are arrays of characters, terminated by a null character (`\0`). The `string.h` library
```c
#include <stdio.h>
#include <string.h>
int main() {
return 0;
```
Refer to the previous sections for a detailed explanation of arrays and the string library.