Two Questions about "strlen", "strcat" and "strcpy"

B

Brian Inglis

No, NULL doesn't denote a string, and even if it did,
a length of -1 would "make sense" only if it pertained
to going backward from the given starting location.

It could also refer to the character before the end of string.
 
R

Richard Bos

Brian Inglis said:
It could also refer to the character before the end of string.

Not as a return value from strlen(), it doesn't. And besides, C != Icon.

Richard
 
D

Douglas A. Gwyn

Brian said:
It could also refer to the character before the end of string.

I suppose almost any arbitrary meaning could be assigned
to meaningless cases. However, strlen can't return a
negative value for any valid string, at least not while
preserving its traditional behavior.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top