?
char* myfunc(char *ptr)
{
ptr+=3;
return(ptr);
}
void main()
{
char *x, *y;
x = "EXAMVEDA";
y = myfunc(x);
printf("y=%s", y);
}
What will be printed when the sample code above is executed?
char* myfunc(char *ptr)
{
ptr+=3;
return(ptr);
}
void main()
{
char *x, *y;
x = "EXAMVEDA";
y = myfunc(x);
printf("y=%s", y);
}
Join the Discussion
Login to post a comment or share your explanation.
Loginwhen we pass X as argument to function, ptr will be assigned to base address of X. ptr is incremented to 3. means internally till 3rd position of X. means after 0th,1st,2nd positions of string.
i.e at M. from that position on wards we are trying to print in printf("y=%s", y);