Sunday 14 April 2013

Void Pointer Program



#include<stdio.h>
int main(){
int a = 10;
void *p = &a;
int *ptr = p;
printf("%u",*ptr);
return 0;
}
(A) 10

(B) Address

(C) 2

(D) Compilation error

(E) None of above


________________________________________
Explanation:

Turbo C++ 3.0: 10

Turbo C ++4.5: 10

Linux GCC: 10

Visual C++: 10



Void pointer can hold address of any data type without type casting. Any pointer can hold void pointer without type casting.

No comments:

Post a Comment