Array variables have same data type (#23142)
An array is a set of homogeneous data. It's important to note that the variables in an array are always of the same data type.
This commit is contained in:
@ -65,7 +65,7 @@ int main(void) {
|
||||
```
|
||||
|
||||
## Strings
|
||||
Arrays are sets of variables, and strings are sets of characters. As a result, we can represent strings with an array. You _can_ declare something in the same way as before, but you'll need to place '\0' as one of your values (more on that in a minute!):
|
||||
Arrays are sets of variables of the same data type, and strings are sets of characters. As a result, we can represent strings with an array. You _can_ declare something in the same way as before, but you'll need to place '\0' as one of your values (more on that in a minute!):
|
||||
```C
|
||||
char hello_world[] = {'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!', '\0'};
|
||||
```
|
||||
|
Reference in New Issue
Block a user