Given the following code in C:
Questions:
a) printf{"%s",p[-2] + 3);
b) printf("%c%s",* (s[1]),*p+1);
c) printf("%c%c%c% c", **s+1, *(*(p-1)+1), *(*s+3)+2, *(p[-1]+strlen(p[-1])-1));
d) *(*p+2) = '\0';
strncat(*p,p[2],2);
printf("%s",*p) ;
My Answers:
a) frame
b) toad
c) rea_ (the last character I don't know)
d) lost
Can someone verify if my answers are correct, if not please help me!
THANK YOU!!
Code:
char *s[] = {"program","test","load","frame","stack",NULL}; char **p = s + 2;
a) printf{"%s",p[-2] + 3);
b) printf("%c%s",* (s[1]),*p+1);
c) printf("%c%c%c% c", **s+1, *(*(p-1)+1), *(*s+3)+2, *(p[-1]+strlen(p[-1])-1));
d) *(*p+2) = '\0';
strncat(*p,p[2],2);
printf("%s",*p) ;
My Answers:
a) frame
b) toad
c) rea_ (the last character I don't know)
d) lost
Can someone verify if my answers are correct, if not please help me!
THANK YOU!!
Comment