int
main()
{
int i;
char c;
void *the_data;
i = 6;
c = 'a';
the_data = &i;
printf("the_dat a points to the integer value %d\n", *(int*) the_data);
^^^^^^^
the_data = &c;
printf("the_dat a now points to the character %c\n", *(char*) the_data);
^^^^^^^^
return 0;
}
On ^^^^ why can't them be typecasted with int and char respectively like
this:
(int) the_data
(char) the_data
main()
{
int i;
char c;
void *the_data;
i = 6;
c = 'a';
the_data = &i;
printf("the_dat a points to the integer value %d\n", *(int*) the_data);
^^^^^^^
the_data = &c;
printf("the_dat a now points to the character %c\n", *(char*) the_data);
^^^^^^^^
return 0;
}
On ^^^^ why can't them be typecasted with int and char respectively like
this:
(int) the_data
(char) the_data
Comment