256 is the number of values โโin one char (which is often an 8-bit byte, and 256 = 2 8 ).
(caveat, the C11 standard allows wider char -s, for example 32 bits, but this is very unusual)
A string is an array or memory area containing several char -s, and conditionally ends with a zero byte.
You can have very large lines, especially using C dynamic memory allocation . For example, on some computers
char*hugestring = malloc(1000000000);
can succeed. Then you can fill this line in a billion bytes. On many computers, the malloc call failed, and you always need to check the result of malloc , at least by following the line above with
if (!hugestring) { perror("malloc hugestring"); exit(EXIT_FAILURE); };
If you use malloc , do not forget to call free later (you need to have agreements on who is responsible for this); otherwise you have a memory leak . BTW asprintf , strdup and open_memstream functions are very useful (but not available everywhere) to conveniently create dynamically allocated lines (inside them malloc used). Tools such as valgrind help detect memory leaks.
You may also have arrays. If they are local variables (aka automatic variables ) they are usually found on the call stack (unless the compiler is optimized for them).
For example, using snprintf to safely fill the local buffer (without buffer overflow ),
char buffer[100]; snprintf(buffer, sizeof(buffer), "x=%d, name=%s", x, name);
but itโs unreasonable to have large frames of calls, so the local array should usually be less than a few hundred bytes (or maybe several thousand). The entire call stack is usually limited to one or more megabytes. Parts are system specific.
Pay attention to character encoding . In 2017, read at least utf8everywhere.org and Unicode .... think char like a byte (since some UTF-8 characters need several bytes, so take a few char -s to represent, so on my Linux desktop strlen("รชtre") is 5 and sizeof("รชtre") is 6 because the underlined letter รช is UTF-8 encoded in two bytes). You can use some library like libunistring .
See also C Link .