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

posted by surbhi just now main() { float a = 5.375; char *p; int i; p=(char*)&a; for(i=0;i<=3;i++) printf("%02x",(unsigned char) p[i]); } how is the output of this program is :: 0000ac40 please let me know y this output has come

2 Answers   GATE,


#include <stdio.h> int main(void) { int a=4, b=2; a=b<<a+b>>2 ; printf("%d",a); return 0; }

0 Answers   Student,


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

1 Answers  


What are segment and offset addresses?

2 Answers   Infosys,


main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above

1 Answers   HCL,






4. Main() { Int i=3,j=2,c=0,m; m=i&&j||c&I; printf(“%d%d%d%d”,I,j,c,m); }

2 Answers   Broadridge,


union u { union u { int i; int j; }a[10]; int b[10]; }u; main() { printf("\n%d", sizeof(u)); printf(" %d", sizeof(u.a)); // printf("%d", sizeof(u.a[4].i)); } a. 4, 4, 4 b. 40, 4, 4 c. 1, 100, 1 d. 40 400 4

3 Answers   HCL,


How to swap two variables, without using third variable ?

104 Answers   AB, ADP, BirlaSoft, Cisco, Cygnet Infotech, HCL, Hewitt, Honeywell, HP, IBM, Infosys, Manhattan, Microsoft, Mobius, Percept, Satyam, SofTMware, TCS, Wipro, Yamaha,


Cau u say the output....?

1 Answers  


main() { char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]); }

1 Answers   DCE,


Printf can be implemented by using __________ list.

3 Answers  


Write a function to find the depth of a binary tree.

13 Answers   Adobe, Amazon, EFI, Imagination Technologies,


Categories