Sail E0 Webinar
Question
What is the output of this C code?
int main()
{
int i = 97, *p = &i;
foo(&p);
printf("%d ", *p);
return 0;
}
void foo(int **p)
{
int j = 2;
*p = &j;
printf("%d ", **p);
}
Options:
A .  2   2
B .  2   97
C .  Undefined behaviour
D .  Segmentation fault/code crash
Answer: Option A


None.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers