employer cover photo
employer logo
employer logo

Torry Harris Integration Solutions

Engaged Employer

Torry Harris Integration Solutions Interview Question

Concatenating two string using pointers

Interview Answer

Anonymous

Sep 25, 2017

#include #include #include int main() { int i,j; char *s1=(char *)malloc(100 * sizeof(char)); char *s2=(char *)malloc(100 * sizeof(char)); scanf("%s%s",s1,s2); j=strlen(s1); for(i=0;s2[i]!='\0';i++){ s1[i+j]=s2[i]; } s1[i+j]='\0'; printf("%s",s1); }

1