Programming tutorials online .NET, Java, C++, Visual Basic, and More
 

Home
.NET Tutorials
General Programming Tutorials
Community/Forums
Site Extras

 

C/C++ Forum
 

Open forum for posting questions or comments regarding C/C++.


VIEW REPLIES | POST REPLY
Posted By: Manoj1986    5/18/2006 8:40:00 AM
 
What is the difference between the line mention below:-
(It is in the c program.In linked list.)
struct node
{
int data;
struct node *link;
};
/*when we allocate the memorary for the new node */
void append(struct node **q,int data)
{
struct *temp;
temp = malloc(sizeof(struct node); /* 1 */
/* AND */

temp = (struct node *) malloc( sizeof (struct node) ); /* 2 */

}

/* tell the difference between different code for allocation
in line 1 we dont mention the cast type
&
in line second we mention the cast type.
*/

REPLY PREVIEW POSTED BY WHEN
Hi, By default the malloc function will allocate memo... wizards 7/25/2006 10:16:00 AM


 
Sign In
Email
Password
  Forgot my password

Search

Featured Book

Introducing Microsoft .Net, Third Edition ($19.79)
Introducing Microsoft .Net, Third Edition


Featured Software

Microsoft Visual Studio Standard 2005 ($249.99)
Microsoft Visual Studio Standard 2005