difference fixed width strings and zero-terminated strings

Posted by robUK on Stack Overflow See other posts from Stack Overflow or by robUK
Published on 2010-05-22T04:15:45Z Indexed on 2010/05/22 4:20 UTC
Read the original article Hit count: 264

Filed under:

Hello,

gcc 4.4.4 c89

I got into a recent discussion about "fixed width strings" and "zero terminated strings".

When I think about this. They seem to be the same thing. A string with a terminating null.

i.e.

char *name = "Joe bloggs";

Is a fixed width string that cannot be changed. And also has a terminating null.

Also in the discussion I was told that strncpy should never been used on 'zero terminated strings'.

Many thanks for any susgestions,

© Stack Overflow or respective owner

Related posts about c