fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int age=10;
  5. char name='c';
  6. void *ptr;
  7. ptr=&age;
  8. int typecast1 = *(int*)ptr;
  9. printf("Generic Pointer points to integer value %d\n",typecast1);
  10. ptr = &name;
  11. char typecast2 = *(char*)ptr;
  12. printf("Generic Pointer points to character name %c",typecast2);
  13. return 0;
  14. }
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
Generic Pointer points to integer value 10
Generic Pointer points to character name c