自己写strcat函数,有点小问题
reading the book of 《the C programing language》,write a program by myself about strcat,but here is a mistake. I recode the program here in order to find the causation in future.#include <stdio.h>void myStrcat(char s[],char t[]){int i=0,j=0;while(s != '\0') i++;while((s=t) != '\0');}int main(){char s[]="abde";char t[]="word!";myStrcat(s,t); printf("%s\n",s);} I guess the problem is the memory of allocation.
页:
[1]