Karma Doe Karma Doe - 8 months ago 27
C Question

C var definition, char limit is bytes or bits?

char name [Number];

[Number] is bytes or bits?


Number specifies the number of elements in the array.

We can do:

char name[10];

To allocate 10 bytes, or something like:

#define Number 10

char name[Number];

This means you can store up to 10 characters, although the \0 sequence marks the end of a string - this tells other string handling functions where the end of the string is.

So techinally we can store 9 characters and the \0 to terminate the string.