LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   malloc error :( (https://www.linuxquestions.org/questions/programming-9/malloc-error-499407/)

studentlb 11-07-2006 08:45 AM

malloc error :(
 
my code contains the following :
char *temp = (char *)malloc(1024, sizeof(char));

am i right ?
beacuse when i m compiling it , it is giving me the folloeing errors:

warning: incompatible implicit declaration of built-in function 'malloc'
error: too many arguments to function 'malloc'

pls help
thanks

demon_vox 11-07-2006 08:51 AM

Hi,
no you are not right. The malloc function only have one parameter not two, thats why you get a "too many arguments" error. Check tha man page for malloc:

Code:

  man malloc
Cheers!

studentlb 11-07-2006 08:57 AM

I ll check the manual.
10x

studentlb 11-07-2006 08:59 AM

thanks a lot :)
problem solved


All times are GMT -5. The time now is 01:32 PM.