Karma Doe Karma Doe - 1 year ago 76
C Question

C var definition, char limit is bytes or bits?

char name [Number];

[Number] is bytes or bits?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download