Samsung Interview Question
Software Engineer / DevelopersCountry: India
Interview Type: Written Test
#include< stdio.h >
void fun(void *p);
int i;
int main()
{
void *vptr;
vptr = &i;
fun(vptr);
return 0;
}
void fun(void *p) --> it contains the address of the I which in the value in vptr
{
int **q;
q = (int**)&p; // we need to take the value of the value at the p address
printf("%d ", **q); // which is nothng but i , since its global it may be un-initialized (.bss) section to where all values will be zero
0
- aka April 13, 2013