C Programming - Pointers - Discussion
Discussion Forum : Pointers - Find Output of Program (Q.No. 6)
6.
What will be the output of the program ?
#include<stdio.h>
void fun(void *p);
int i;
int main()
{
void *vptr;
vptr = &i;
fun(vptr);
return 0;
}
void fun(void *p)
{
int **q;
q = (int**)&p;
printf("%d\n", **q);
}
Discussion:
95 comments Page 8 of 10.
Santhosh said:
1 decade ago
I Can't understand the program. Can anyone explain?
Suriya said:
1 decade ago
How can I know I is the extern variable or global?
Mangesh said:
1 decade ago
Because global veriable is set to 0 (by defult).
Jerin said:
1 decade ago
in (int**)p p is typecasted to integer pointer.
Sanjay kr. said:
1 decade ago
I can't understand can any one explain please.
Mahi khan said:
1 decade ago
How 0 is output and what is the use of int**?
Sujay said:
1 decade ago
Can any one explain me about (int**) &p;?
Nagma said:
9 years ago
Because 'i' is a global variable not extern.
Ranjeet said:
1 decade ago
Is q and **q are same thing? please tell me.
Alekhya said:
8 years ago
How can you assign a value to null pointer?
(1)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers