Here is another problem from K&R , I have been sittin with it for 4 hours
This program tried to concatenate two strings. It aint doin it
Code:
#include "stdio.h"
int str_cat(char *, char *);
int main()
{
char *str1 = "saguna";
char *str2 = "karan";
str_cat(str1,str2);
return 0;
} //main closes
int str_cat(char *st1, char *st2)
{
for(; *st1 != '\0'; st1++)
{
if(*st1 == '\0')
{
printf("check "); //not goin in if statement, it goes till s
for(;*st2 != '\0';st2++)
{
*st2 == *st1;
}
printf("The value of *st2=\n\n\n\n\n%c",*st2);
//return *st2;
}
else
{
printf("\nsomethings wronng\n");
}
}
} //str_cat closes