Friday, June 25, 2010

Matrix using dynamic memory allocation in C

> a = malloc(sizeof(int)*3);
should have been
 a = malloc(sizeof(int *)*3);

>Why is it okay?
>Shouldn't I be typecasting them explicitly?
You dont have to ... since C99 ...
http://www.cprogramming.com/faq/cgi-bin/smartfaq.cgi?answer=1047673478&id=1043284351

No comments:

Blog Archive