Example for char pointers and strings in c:
What is the output of below C program.
char *s1 = "skill, ";
char *s2 = "gun technologies";
char *s3 = strcat(s1, s2);
skill, gun technologies
either crash or some garbage.
String s1, doesn't have enough space to add string 2. we have to specifically malloc sufficient space to s1. So it may crash or may behave vaguely as we are trying to writing to some location which is not allocated properly.
Back To Top