String and Char*

I'm just wondering.. how are the uses between a string and a char* (a pointer to a character?) different?
Last edited on
That depends on what you mean by the term 'string'. If you are talking about C-strings, which are arrays of charaters e.g. char str[80]; this technically is a char* as it points to the first element in memory of the array and reads until a NULL character is read.
I'm feeling pedantic right now.

NULL is a pointer, NUL is a character. You can refer to NUL in the lower case as "null-terminated" or the "null character", but in C/C++ NULL (in all caps) refers to a NULL pointer. In the ASCII table the ordinal value 0 is called NUL. Please don't confuse the two.

http://www.lysator.liu.se/c/c-faq/c-1.html#1-8

@PanGalactic ... Thank you!
Topic archived. No new replies allowed.