This doesn't work in normal C either.
s.P = malloc(sizeof(int));
Visual Studio says...
"a value of type "void *" cannot be assigned to an entity of type "int *"
Sounds like you compiled with C++ compiler.
C performs an implicit cast, whereas C++ requires an explicit cast for void* (static_cast<int*>)
Compiles in C
#include <stdlib.h>
#include <stdio.h>
struct S
{
int* P;
};
int main()
{
struct S s;
s.P = malloc(sizeof(int));
*(s.P) = 1234; // Ok
s.P[0] = 1234; // Ok
int* p = s.P;
p[0] = 2345; // Ok
printf("%d", *(s.P));
free(s.P);
return 0;
}