Though it's said that string is an array of characters why string variable does not have square brackets on the immediate right?

In CS50 we call string as string s

why not as string[]? then how can we say that string is an array of characters, if so how does the array is formed without following the syntax?

1 Answer 1


The reason why a string variable does not have brackets, is because it is not a string array. (It is a char array or a char pointer.)

In fact, string is a new type, defined in the cs50 library. It will be explained in one of the following lectures (possibly Lecture 4).

And to quote Cliff B:

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .