• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

something I don't get from a C book that I am reading

Onceler

Golden Member
it says
int strlen(char s[])
{
int i;
i=0;
while (s!='\0')
++i;
return i;
}
the s wouldn't that be 0 since on the line before it it was declared that i=0;?
 
i is an index. i=0 means it is starting at the first character. It increments the index with each iteration of the loop.

Also char s[] is the same as char* s
 
It's saying - start from the start (zeroth element) of the string (or an array of characters) until you reach the end, which in this case is the null character ("\0"). i returns the length of that string.
 
Don't think so. I actually tried reading all the memory I could reach. Crash happens when you try to modify there something.
 
Don't think so. I actually tried reading all the memory I could reach. Crash happens when you try to modify there something.

Yeah, the only way you would crash (or likely hang) is if there were no bytes in memory that were 0, which is fairly [extraordinarily] unlikely, and the loop would run infinitely.
 
Back
Top