Files
CWithClasses/C/BasicSyntax/Pointer/pointer_function_str1.cpp
2025-12-31 00:39:23 +08:00

41 lines
627 B
C++

#include <stdio.h>
#include <stdlib.h>
char str[201];
/*char * add(char *str1,char *str2){
int i=0;
while(*str1!='\0'){
str[i]=*str1;
i++;str1++;
}
while(*str2!='\0'){
str[i]=*str2;
i++;str2++;
}
str[i]='\0';
//printf("%s\n",str);
//return str;
}*/
void add(char *str1,char *str2){
int i=0;
while(*str1!='\0'){
str[i]=*str1;
i++;str1++;
}
while(*str2!='\0'){
str[i]=*str2;
i++;str2++;
}
str[i]='\0';
//printf("%s\n",str);
//return str;
}
int main(){
char a[100],b[100];
//char * p= (char *)malloc(201*sizeof(char));
scanf("%s%s",a,b);
add(a,b);
printf("%s",str);
//free(p);
return 0;
}