3 ms·
> Strings in C are 0-terminated char arrays To be pedantic, they're pointers to char. Nothing more. Calling them array confuses non-C coders. The length is jus
by alcover 3y ago
> Strings in C are 0-terminated char arrays
To be pedantic, they're pointers to char. Nothing more. Calling them array confuses non-C coders. The length is just an unenforced contract and has to be passed.
- TillE 3y agoIt's a pointer to a chunk of memory which contains an array of characters. You pass around the pointer because copying an array is expensive and wasteful. I think (or hope) the concepts are pretty clear if you understand what a pointer is.