I'm just experimenting with void pointers, I wanted to use them on C-type strings. It seems that this line of code throws the exception, but I don't know why:
printf("My name is %s", *((char*)ptr));
Here is the entire code:
int main()
{
char prenume[] = "Alexandru";
char* name = prenume;
int age = 33;
float height = 1.81;
void* ptr;
ptr = name;
printf("My name is %s", *((char*)ptr));
ptr = &age;
printf("\nAge:%d", *((int*)ptr));
ptr = &height;
printf("\nHeight:%2.2f", *((float*)ptr));
return 0;
}
I am using MS Visual Studio
I would appreciate any answer...thanks!

