Home > Back-end >  Small white inquired, is really very simple
Small white inquired, is really very simple

Time:11-04

Excuse me, can ring 2 fill in p -s? Feel the string pointer and the relationship between the character array is ambiguous... O give directions! Thank you very much!

CodePudding user response:

Here you can fill in the p - s; And the back of the annotation also illustrates this,
In addition, it is important to note myStrlen function s, while writing is an array, is actually a pointer, since the compiler has been in accordance with the pointer,

From another knowledge also can prove that this is not an array, but a pointer, according to the parameter value is passed, the argument is assigned to the parameter (can be understand so), if the parameter is an array name, according to the array name can't be an lvalue, so contradiction,

So, parameter name written in the array, directly can be understood as a pointer,

CodePudding user response:

No code is not the truth

CodePudding user response:

After a while loop, p has reached the last element of an array of address
While s said that the first element in the array address
So here can be directly use p - s
  • Related