What is the main difference between the two declarations given below:

1. pi=(int*)malloc(sizeof(int));

2. pi=malloc(sizeof(int));

As far as I've learned, in the 1st declaration, the first byte of the memory of size of integer is returned to pi, which is of integer type. But then, what's the second declaration for?