I just can't figure out strcat.
Posted
by
Anonymous
on Stack Overflow
See other posts from Stack Overflow
or by Anonymous
Published on 2011-01-16T20:40:25Z
Indexed on
2011/01/16
20:53 UTC
Read the original article
Hit count: 175
I know I shouldn't be using that function, and I don't care. Last time I checked the spec for strcat, it said something along the lines of updating the first value as well as returning the same.
Now, this is a really stupid question, and I want you to explain it like you're talking to a really stupid person.
Why won't this work?
char* foo="foo";
printf(strcat(foo,"bar"));
EDIT: I don't know the difference between char[] and char*. How would I allocate a string of 255 characters?
EDIT 2: OK, OK, so char[number] allocates a string of that many bytes? Makes sense. Thanks.
© Stack Overflow or respective owner