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 7 of 10.
Udaysiri said:
1 decade ago
void is null when void is given in local variable it's print 0.
Rupinderjit said:
1 decade ago
By default the compile initialize the global variable to 0.
Gireesh said:
1 decade ago
Can anyone tell about void. Actually what is mean by void?
Anil said:
1 decade ago
If we don't declare i as a global, then what will be o/p?
Sumit said:
2 decades ago
Please explain, how "0" will be displayed???
Saranya.s said:
8 years ago
I am not getting this, anyone please explain clearly.
(1)
Ishwar lal janwa said:
1 decade ago
How come 0 and the fun call & is not define why ?
Tekme2god said:
1 decade ago
I am not clear all about this thing. Please help me.
Shishir Singh said:
5 years ago
Default value of global variable is set to 0 (zero).
(6)
Pankaj said:
1 decade ago
What a question any one have a answer with exmpl. ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers