#include <stdio.h>
#include <string.h>
int main(){
char a[7]= "car";
char b[7]="yyoug";
strcat(a,b[2]);
puts(a);
return 0;
}
This won't compile. It says "passing argument 2 of 'strcat' makes pointer from integer without a cast." I haven't been taught the use of pointers.
b[2]
gives the values of the 3rd element in the array.&b[2]
gives the address.. That is expected fromstrcat()
– Gopistrcat(a,&b[2]);
orstrcat(a,b+2);
– Tom Karzesstrncat(a,&b[2],1);
– Tom Karzes