Everyones suggesting not to cast while allocating a pointer here, do I cast result of malloc
But my below non-casted code produce compiler error in VS-2013. Why!
#include <stdio.h>
#include <malloc.h>
int main(){
int *ptr = malloc(sizeof(int) * 100); // compiler error
return 0;
}
Compiler error is,
1 IntelliSense: a value of type "void *" cannot be used to initialize an entity of type "int *"