| Lim Boon Jye (53) | |||
I not really understand how the code trying to say It's say that what negative aspects of pointer does this fragment exhibit that makes it difficult to read? | |||
|
|
|||
| vlad from moscow (3112) | |
|
The code calculates the length of a character array pointed to by 'p'. It finds the terminate symbol '\0' and then substructs the pointer to the initial symbol from the pointer to that terminate symbol and gets number of bytes between them. It would be better to write const char *r = p; instead of char *r = (char*)p; | |
|
Last edited on
|
|
| Lim Boon Jye (53) | |
|
can provide a example for me? example i insert a string of flower | |
|
|
|
| vlad from moscow (3112) | |||
|
I did not understand what example are you speaking about? Using of the function
| |||
|
Last edited on
|
|||
| Script Coder (352) | |
| Not to be pedantic, but vlad please change the ';' to a ':' in std::cout | |
|
|
|
| vlad from moscow (3112) | ||
Thanks, I hope I have updated this typo.:) | ||
|
|
||