Look at section 6.4.5 for string literals. The main point you will want to read would be:
Code:
The contents of the arrays are modifiable. On the other hand, the declaration
char *p = "abc";
defines p with type ‘‘pointer to char’’ and initializes it to point to an object with type ‘‘array of char’’
with length 4 whose elements are initialized with a character string literal. If an attempt is made to use p to
modify the contents of the array, the behavior is undefined.
Using a pointed literal is considered undefined behavior which leaves it as an assumed const.
2. I'm not quite sure I understand your question. Are you asking if you need to remember them without having to look them up? There is nothing wrong if referencing the documentation when needed. You are not going to remember every single function in the standard libraries for C or C++. It is better to reference the docs than to guess and write bad code that has issues. _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum