Top

Discussion

What will be returned in the following C code?

size- t strlen(const char *s)
const char *sc;
for(sc = s; *sc!= ' \ O ' ; ++sc)
return(sc - s) ;

 

  • A.number of characters equal in sc
  • B.length of string s
  • C.doesn’t return any value
  • D.displays string s

Answer: B

The strlen() function is used to return the length of the string s.

No comment is present. Be the first to comment.
Loading…

Post your comment