I have the following code
Code:
#include <stdio.h>
int main(){
double *a;
a = malloc(4*sizeof(double));
free(a);
return 0;
}
It produces the warning messages
warning C4047: '=' : 'double *' differs in levels of indirection from 'int'
I tried to cast the the value that a is set to by changing the code to this
Code:
#include <stdio.h>
int main(){
double *a;
a = (double*)malloc(4*sizeof(double));
free(a);
return 0;
}
but then I get the message
warning C4312: 'type cast' : conversion from 'int' to 'double *' of greater size
Is it possible to code this so that MSVC++ doesn't give me warning messages? GCC never seems to gives me any complaints. If C++ is really a superset of C, why does this not compile with G++?