This is a discussion on Question about connecting strings and
within the C Programming
forums, part of the General Programming Boards category; There's a string with four numbers and a
sign, which's making it needing array size of 5:
Question about connecting strings and \0
There's a string with four numbers and a \0 sign, which's making it needing array size of 5:
Now, i want to connect three of these strings with sprintf:
char string = "1234";
Now, what array size should string StringSonnected have?
sprintf(StringsConnected,"%s%s%s",string,string,string) // probably not the best way, but still ...
- 13, for 123412341234 and \0 or
- 15, for 1234\01234\01234\0 or
- even 16, for 1234\01234\01234\0\0?
and the hat of int overfl
> - 13, for 123412341234 and \0 or
Is the correct answer.
Popular pages Recent additions