Hi,
I'm sure there is a simple explanation for this, but it is frustrating me. This code:
yields output:
but THIS code:
yields output:
or something similar (i.e. a tail portion of the second string) for other values of pcFirst and pcSecond.
Shouldn't they both work the same, if strcat itself just returns a char*?
thank you - I'm sure it's something silly and trivial but
i can not figure it out.
:-S
dora c
I'm sure there is a simple explanation for this, but it is frustrating me. This code:
Code:
#include <string.h>
void main()
{
char* pcFirst = "first";
char* pcSecond = "second";
char* pcConcat = strcat( pcFirst
,pcSecond );
printf("concatenated: .%s.\n", pcConcat);
}
Code:
concatenated: .firstsecond.
Code:
#include <string.h>
void main()
{
char* pcFirst = "first";
char* pcSecond = "second";
char* pcConcat =
strcat( pcFirst
,strcat( " : ", pcSecond ) );
printf("concatenated: .%s.\n", pcConcat);
}
Code:
econd
Shouldn't they both work the same, if strcat itself just returns a char*?
thank you - I'm sure it's something silly and trivial but
i can not figure it out.
:-S
dora c