LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-07-2006, 08:45 AM   #1
studentlb
Member
 
Registered: Oct 2006
Posts: 53

Rep: Reputation: 15
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
 
Old 11-07-2006, 08:51 AM   #2
demon_vox
Member
 
Registered: May 2006
Location: Argentina
Distribution: SuSE 10
Posts: 173

Rep: Reputation: 30
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!
 
Old 11-07-2006, 08:57 AM   #3
studentlb
Member
 
Registered: Oct 2006
Posts: 53

Original Poster
Rep: Reputation: 15
I ll check the manual.
10x
 
Old 11-07-2006, 08:59 AM   #4
studentlb
Member
 
Registered: Oct 2006
Posts: 53

Original Poster
Rep: Reputation: 15
thanks a lot
problem solved
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
malloc error: glibc vdhussa Linux - General 10 05-31-2006 09:47 AM
malloc anoosh Programming 1 03-15-2006 04:41 PM
malloc eagle683 Programming 6 05-22-2005 02:40 PM
malloc() vijeesh_ep Programming 4 08-25-2004 03:50 PM
gdbm malloc error Sammy2ooo Linux - Software 0 11-07-2003 04:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration