#include <stdio.h>
#include <stdlib.h>
char stringcat(char arr[100],char arr2[100]);
int main()
{
char arr[100],arr2[100];
stringcat(arr,arr2);
}
char stringcat(char arr[100],char arr2[100])
{
int i,ans,ans2,result,counter=0;
printf("Enter arr\n");
gets(arr);
for(i=0;arr[i]!='\0';i++)
{
}
ans=i;
printf("The length of arr 1 is=%d\n",ans);
printf("Enter 2nd arr\n");
gets(arr2);
for(i=0;arr2[i]!='\0';i++)
{
}
ans2=i;
printf("The length of arr 2 is=%d\n",ans2);
result=ans+ans2;
char arr3[result];
arr3[result];
for(i=0;i<=result;i++)
{
arr3[i]=arr[i];
if(i==ans||i>ans)
{
arr3[i]=arr2[counter];
counter++;
}
}
puts(arr3);
}
#include <stdlib.h>
char stringcat(char arr[100],char arr2[100]);
int main()
{
char arr[100],arr2[100];
stringcat(arr,arr2);
}
char stringcat(char arr[100],char arr2[100])
{
int i,ans,ans2,result,counter=0;
printf("Enter arr\n");
gets(arr);
for(i=0;arr[i]!='\0';i++)
{
}
ans=i;
printf("The length of arr 1 is=%d\n",ans);
printf("Enter 2nd arr\n");
gets(arr2);
for(i=0;arr2[i]!='\0';i++)
{
}
ans2=i;
printf("The length of arr 2 is=%d\n",ans2);
result=ans+ans2;
char arr3[result];
arr3[result];
for(i=0;i<=result;i++)
{
arr3[i]=arr[i];
if(i==ans||i>ans)
{
arr3[i]=arr2[counter];
counter++;
}
}
puts(arr3);
}
Post a Comment