Whats the difference between...plz respond in the next 5-10min

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2007
Posts: 15
Reputation: warpstar is an unknown quantity at this point 
Solved Threads: 0
warpstar warpstar is offline Offline
Newbie Poster

Whats the difference between...plz respond in the next 5-10min

 
0
  #1
Oct 26th, 2007
Whats the difference between:

pp = malloc(m*sizeof(int)) <--- I understand this

and

pp = **int malloc (m*sizeof(int)) <--- but not this ?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,484
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: 1478
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Whats the difference between...plz respond in the next 5-10min

 
0
  #2
Oct 26th, 2007
The second example is illegal syntax, maybe you meant this?
pp = (int**) malloc (m*sizeof(int))

The first example is ok in C language but not in C++, which requires the return value of malloc() to be typecast to the appropriate type of variable. Other than the typecast they both are identical.

And BTW you shouldn't expect people to respond so quickly to a question.
Last edited by Ancient Dragon; Oct 26th, 2007 at 8:16 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Whats the difference between...plz respond in the next 5-10min

 
0
  #3
Oct 27th, 2007
This is all I have to say about the topic title.
http://catb.org/~esr/faqs/smart-questions.html#urgent
Reply With Quote Quick reply to this message  
Reply

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



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC