L
Logan Lee
int
main()
{
int i;
char c;
void *the_data;
i = 6;
c = 'a';
the_data = &i;
printf("the_data points to the integer value %d\n", *(int*) the_data);
^^^^^^^
the_data = &c;
printf("the_data 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_data points to the integer value %d\n", *(int*) the_data);
^^^^^^^
the_data = &c;
printf("the_data 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