Code:
char *str2;
char *first1 = "Learn";
char *second1 = "C";
char *third1 = "Online";
str2=(char *)malloc(strlen(first1)+strlen(second1)+strlen(third1)+3);
sprintf(str2, "%s %s %s",first,second,third);


puts(str2);
Its printing garbage can you please help me