I wrote the following code for string concatnation using pointers in C
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void strCat(char *str1,char *str2);
int main(void)
{
char str1[] = "Rohit";
char str2[] = "Kumar";
strCat(str1,str2);
return 0;
}
void strCat(char *str1,char *str2)
{
int i;
char *start;
start = str1;
printf("%s",str1);
while(*str1++ != '\0')
continue;
while(*str2 != '\0')
*str1++ = *str2++;
*str1 = '\0';
printf("%s\n",str1);
}
Why the ouput is Rohit(null). Please Help!!
strcat).