Click here to Skip to main content
15,394,162 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionproblem Pin
hmaz462930-Apr-11 23:49
Memberhmaz462930-Apr-11 23:49 
AnswerRe: problem Pin
Rajesh R Subramanian1-May-11 0:01
professionalRajesh R Subramanian1-May-11 0:01 
AnswerRe: problem Pin
«_Superman_»1-May-11 2:16
professional«_Superman_»1-May-11 2:16 
Questionlinked list adding operation with two structure type Pin
quartaela30-Apr-11 3:42
Memberquartaela30-Apr-11 3:42 
AnswerRe: linked list adding operation with two structure type Pin
Luc Pattyn30-Apr-11 4:22
sitebuilderLuc Pattyn30-Apr-11 4:22 
GeneralRe: linked list adding operation with two structure type Pin
quartaela30-Apr-11 5:13
Memberquartaela30-Apr-11 5:13 
AnswerRe: linked list adding operation with two structure type Pin
Luc Pattyn30-Apr-11 5:36
sitebuilderLuc Pattyn30-Apr-11 5:36 
AnswerRe: linked list adding operation with two structure type Pin
Andrew Phillips30-Apr-11 5:17
MemberAndrew Phillips30-Apr-11 5:17 
This is obviously an assignment but I'll give you some ideas.

a. It's better to use an existing container like std::list but if this is C and you don't have one or you have to write your own linked list then ...

b. You don't need to store current. I also assume you store tail and count for efficiency as you can work these out too.

c. You store tail but then in add_Node() you scan the list for the end anyway.

d. It may be simpler just to add new students to the start of the list rather than the end.
NODE * tmp = head;
head = student;
student->next = tmp;

e. If you step through your code the bvious problem is assigning through a NULL pointer. Why not do it like this:
void add_Node(LIST** list, NODE* student)
{
     NODE ** pcurr;
     for (pcurr = &head; *pcurr != NULL; pcurr = &((*pcurr)->next) )
         ;  // no loop body
     *pcurr = student;
     student->next = NULL;
 }

Andrew Phillips
http://www.hexedit.com
andrew @ hexedit.com

GeneralRe: linked list adding operation with two structure type Pin
quartaela30-Apr-11 5:35
Memberquartaela30-Apr-11 5:35 
GeneralRe: linked list adding operation with two structure type Pin
Andrew Phillips30-Apr-11 5:59
MemberAndrew Phillips30-Apr-11 5:59 
AnswerRe: linked list adding operation with two structure type Pin
Luc Pattyn30-Apr-11 6:10
sitebuilderLuc Pattyn30-Apr-11 6:10 
GeneralRe: linked list adding operation with two structure type Pin
quartaela30-Apr-11 8:03
Memberquartaela30-Apr-11 8:03 
GeneralRe: linked list adding operation with two structure type Pin
Luc Pattyn30-Apr-11 8:10
sitebuilderLuc Pattyn30-Apr-11 8:10 
GeneralRe: linked list adding operation with two structure type Pin
quartaela30-Apr-11 8:16
Memberquartaela30-Apr-11 8:16 
GeneralRe: linked list adding operation with two structure type Pin
quartaela30-Apr-11 8:20
Memberquartaela30-Apr-11 8:20 
GeneralRe: linked list adding operation with two structure type Pin
Luc Pattyn30-Apr-11 8:32
sitebuilderLuc Pattyn30-Apr-11 8:32 
QuestionProblem in Callback function in Client Application [modified] Pin
manoharbalu30-Apr-11 1:27
Membermanoharbalu30-Apr-11 1:27 
AnswerRe: Problem in Callback function in Client Application Pin
Hans Dietrich30-Apr-11 4:27
mentorHans Dietrich30-Apr-11 4:27 
QuestionIs there any way to SendMessage to a Button control Pin
lamparded30-Apr-11 1:27
Memberlamparded30-Apr-11 1:27 
AnswerRe: Is there any way to SendMessage to a Button control Pin
«_Superman_»30-Apr-11 2:12
professional«_Superman_»30-Apr-11 2:12 
GeneralRe: Is there any way to SendMessage to a Button control Pin
lamparded30-Apr-11 3:27
Memberlamparded30-Apr-11 3:27 
AnswerRe: Is there any way to SendMessage to a Button control Pin
Hans Dietrich30-Apr-11 4:18
mentorHans Dietrich30-Apr-11 4:18 
GeneralRe: Is there any way to SendMessage to a Button control Pin
Richard MacCutchan30-Apr-11 5:33
mveRichard MacCutchan30-Apr-11 5:33 
GeneralRe: Is there any way to SendMessage to a Button control Pin
lamparded30-Apr-11 6:18
Memberlamparded30-Apr-11 6:18 
GeneralRe: Is there any way to SendMessage to a Button control Pin
Richard MacCutchan30-Apr-11 6:51
mveRichard MacCutchan30-Apr-11 6:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.