int main ()
int strlen(char*s)
{char *p = s;
while (*p! = '/0');
p++;
return p - s;
What does this program do?
int main ()
int strlen(char*s)
{char *p = s;
while (*p! = '/0');
p++;
return p - s;
What does this program do?
To understand, take a ruler, choose a mark near the left (point A) and the right (point B). If you subtract A from B, you should get the length of segment AB. That's what the program does.
> What does this program do?
It doesn't do a damn thing, because it won't compile.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
yes salem is right.