StringsC doesn't know what a string is! The common definition of a C string is a null-terminated character array, but C doesn't understand that definition either. There are however functions that are part of the C Standard Library that depend on that definition to work correctly. In fact, failure to null-terminate a C string will most likely result in a catastrophic end to the program. But isn't Hi in the statement printf("Hi"); a string? No, not to C. The compiler stashes Hi in an array of 3 characters. Like this: The is no way to declare a string variable in C. In order to properly handle strings, an understanding of Arrays and Pointers is required. |
|