compiler error when address of a pointer is passed

Reply

Join Date: Dec 2008
Posts: 10
Reputation: prashanth s j is an unknown quantity at this point 
Solved Threads: 0
prashanth s j prashanth s j is offline Offline
Newbie Poster

compiler error when address of a pointer is passed

 
0
  #1
Dec 29th, 2008
Hi all,
I am getting a compiler error for the following:


The following is the declaration in the header:
void init(INBUFF ** , OUTBUFF ** ); ---->line no 21

The following is the function init:
void init(INBUFF ** inbuffptr, OUTBUFF ** outbuffptr)
{ ------------------->line no 81
*inbuffptr = (INBUFF *) malloc(sizeof(INBUFF));
*outbuffptr = (OUTBUFF *) malloc(sizeof(OUTBUFF));
(*inbuffptr)->begin = (*inbuffptr)->end = (*inbuffptr)->next = NULL;
(*outbuffptr)->begin = (*outbuffptr)->end = NULL;
}

This function is invoked by the following code snippet:
INBUFF * inbuff1 = NULL;
OUTBUFF * outbuff1 = NULL;
init(&inbuff1, &outbuff1);


The error that I get when i compile is:

Icore.c:81: error: conflicting types for âinitâ
Iheader.h:21: error: previous declaration of âinitâ was here


Could any one please tell why this compiler error is being generated?

Thanks,
Prashanth
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 16,513
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1605
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning

Re: compiler error when address of a pointer is passed

 
0
  #2
Dec 29th, 2008
Might be a missing semicolon previous to line 81 in the *.cpp file, or missing header file, or missing declaration of INBUFF and OUTBUFF, or a host of other things.
The most important thing in the Olympic Games is not to win but to take part, just as the most important thing in life is not the triumph but the struggle. The essential thing is not to have conquered but to have fought well.
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 44
Reputation: me_ansh is an unknown quantity at this point 
Solved Threads: 5
me_ansh me_ansh is offline Offline
Light Poster

Re: compiler error when address of a pointer is passed

 
0
  #3
Jan 22nd, 2009
As per the data provided by you, everything seems fine so please post the complete code in flow....
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 487 | Replies: 2
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC