Forum Discussion
Altera_Forum
Honored Contributor
20 years agoReboot when running program with two .c files
I wrote a very simple test program that runs just fine: int main(int argc, char *argv)
{
unsigned char *p = (unsigned char *) malloc(2048*sizeof(unsigned char));
printf("Allocation via ma...
Altera_Forum
Honored Contributor
20 years agohi,
--first thing :u try to allocate 2048 of unsigned char which is equal to 2 Mb, I think it's to much ! regardless your RAM size ? --seconde thing : to know that malloc() succeded u must do a test like :if (p =! NULL) then ... so I advice u to reduce the allocation size (something like 512 bytes). http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/rolleyes.gif best regards.