Pointer - Study Mode
[#181] 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?
Correct Answer
(C) y=MVEDA
[#182] char *ptr
char myString[] = "abcdefg"
ptr = myString
ptr += 5
what string does ptr point to in the sample code above?
Correct Answer
(A) fg
[#183] What will be the output of the following C code? #include <stdio.h>
int main()
{
int i = 10
int *p = &i
foo(&p)
printf("%d ", *p)
printf("%d ", *p)
}
void foo(int **const p)
{
int j = 11
*p = &j
printf("%d ", **p)
}
Correct Answer
(B) 11 11 Undefined-value
[#184] What will be the output of the following C code? #include <stdio.h>
void main()
{
char *s= "hello"
char *p = s
printf("%c %c", *(p + 3), s[1])
}
Correct Answer
(D) l e
[#185] What will be the output of the following C code? #include <stdio.h>
void main()
{
char *s = "hello"
char *p = s * 3
printf("%c %c", *p, s[1])
}
Correct Answer
(C) Compile time error