+ 5
char dept[] = "HR";
This is an instance of a C-style string - An array of characters with a null-terminator.
In general, if you do not specify the array size, the array will be sized to fit the contents assigned to it. E.g.
int arr[] = {1,2,3};
has size 3.
Going back to C-style strings, we did mention that they are null terminated. So
char dept[] = "HR";
would be of size 3, storing 'H', 'R', '\0'.
You can check the size of an array by printing:
sizeof(dept)/sizeof(dept[0])
The size of the entire array in bytes divided by the size of a single array element in bytes, giving the number of slots of an array.



