void main()

{

void *v;

int integer=2;

int *i=&integer;

v=i;

printf("%d",(int*)*v);

}



void main() { void *v; int integer=2; int *i=&integer; v=i; printf("..

Answer / susie

Answer :

Compiler Error. We cannot apply indirection on type void*.

Explanation:

Void pointer is a generic pointer type. No pointer
arithmetic can be done on it. Void pointers are normally
used for,

1. Passing generic pointers to functions and returning such
pointers.

2. As a intermediate pointer type.

3. Used when the exact pointer type will be known at a later
point of time.

Is This Answer Correct ?    11 Yes 1 No

Post New Answer

More C Code Interview Questions

#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }

1 Answers  


abcdedcba abc cba ab ba a a

2 Answers  


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

0 Answers  


main() { int (*functable[2])(char *format, ...) ={printf, scanf}; int i = 100; (*functable[0])("%d", i); (*functable[1])("%d", i); (*functable[1])("%d", i); (*functable[0])("%d", &i); } a. 100, Runtime error. b. 100, Random number, Random number, Random number. c. Compile error d. 100, Random number

1 Answers   HCL, rsystems,


write the function. if all the character in string B appear in string A, return true, otherwise return false.

11 Answers   Google,






main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit >> (i - (i -1))); } } a. 512, 256, 0, 0, 0 b. 256, 256, 0, 0, 0 c. 512, 512, 512, 512, 512 d. 256, 256, 256, 256, 256

2 Answers   HCL,


why is printf("%d %d %d",i++,--i,i--);

4 Answers   Apple, Cynity, TCS,


#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }

2 Answers  


what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++i] + ++i +(++i); printf("%d",num); }

3 Answers   Wipro,


Write a program to receive an integer and find its octal equivalent?

7 Answers  


#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }

4 Answers   Google, HCL, Quick Heal, WTF,


There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.

1 Answers   TCS,


Categories