944,098 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 728
  • C++ RSS
Oct 26th, 2007
0

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

Expand Post »
Whats the difference between:

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

and

pp = **int malloc (m*sizeof(int)) <--- but not this ?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
warpstar is offline Offline
15 posts
since Oct 2007
Oct 26th, 2007
0

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

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is online now Online
21,961 posts
since Aug 2005
Oct 27th, 2007
0

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

This is all I have to say about the topic title.
http://catb.org/~esr/faqs/smart-questions.html#urgent
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: The * in a function.
Next Thread in C++ Forum Timeline: displaying arrays





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC