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:
wolfwhocodes
2018-10-22 22:56:06 +05:30
committed by Aditya
parent 4aa7b618cb
commit 0c1ca98205

View File

@ -65,7 +65,7 @@ int main(void) {
``` ```
## Strings ## 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 ```C
char hello_world[] = {'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!', '\0'}; char hello_world[] = {'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!', '\0'};
``` ```