Click here to Skip to main content
15,890,512 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questiona pointer Pin
youbo26-Sep-07 21:01
youbo26-Sep-07 21:01 
AnswerRe: a pointer Pin
youbo26-Sep-07 21:31
youbo26-Sep-07 21:31 
GeneralRe: a pointer Pin
toxcct26-Sep-07 21:39
toxcct26-Sep-07 21:39 
AnswerRe: a pointer Pin
toxcct26-Sep-07 21:35
toxcct26-Sep-07 21:35 
GeneralRe: a pointer Pin
John R. Shaw26-Sep-07 21:52
John R. Shaw26-Sep-07 21:52 
GeneralRe: a pointer Pin
toxcct26-Sep-07 21:54
toxcct26-Sep-07 21:54 
GeneralRe: a pointer Pin
John R. Shaw26-Sep-07 23:12
John R. Shaw26-Sep-07 23:12 
AnswerRe: a pointer Pin
baerten26-Sep-07 21:37
baerten26-Sep-07 21:37 
Hi,

that's a unidirectional list.

if your struct ListEntry is :
struct ListEntry {
  char value[50]; 
  struct ListEntry * next;
}

you allocate the first element, so you have a string and a blank pointer.
struct ListEntry *First = (struct ListEntry*)malloc(sizeof(struct ListEntry*));
First->next = NULL;
strcpy(First->value,"empty");


now you set the next-pointer to a new allocation of a new struct.
First->next = (struct ListEntry*)malloc(sizeof(struct ListEntry*));


So you can reach the new Element by dereferencing the node->next : node->next->value.

You should always store and save the first element.

Each time you like to add a new element you need to loop from the first element to the last
( which is the element with the next-pointer as NULL )

If you have 5 elements with numbers into it, it can be represented this way :

|"one"|0x4567| ---> |"two"|0x4568| --> |"three"|0x4569| ---> |"four"|0x4570| ---> |"five"|NULL|
GeneralRe: a pointer Pin
youbo26-Sep-07 21:45
youbo26-Sep-07 21:45 
GeneralRe: a pointer [modified] Pin
Russell'26-Sep-07 22:29
Russell'26-Sep-07 22:29 
GeneralRe: a pointer Pin
toxcct26-Sep-07 22:44
toxcct26-Sep-07 22:44 
GeneralRe: a pointer Pin
Russell'26-Sep-07 22:56
Russell'26-Sep-07 22:56 
QuestionUrgent - How to identify given image is too dark or light Pin
sujtha26-Sep-07 20:51
sujtha26-Sep-07 20:51 
AnswerRe: Urgent - How to identify given image is too dark or light Pin
Waldermort26-Sep-07 21:00
Waldermort26-Sep-07 21:00 
GeneralRe: Urgent - How to identify given image is too dark or light Pin
toxcct26-Sep-07 22:48
toxcct26-Sep-07 22:48 
AnswerRe: Urgent - How to identify given image is too dark or light Pin
Russell'26-Sep-07 22:37
Russell'26-Sep-07 22:37 
GeneralRe: Urgent - How to identify given image is too dark or light Pin
Nishad S27-Sep-07 1:56
Nishad S27-Sep-07 1:56 
GeneralRe: Urgent - How to identify given image is too dark or light Pin
Russell'27-Sep-07 2:14
Russell'27-Sep-07 2:14 
GeneralRe: Urgent - How to identify given image is too dark or light Pin
Nishad S27-Sep-07 3:06
Nishad S27-Sep-07 3:06 
GeneralRe: Urgent - How to identify given image is too dark or light Pin
Russell'27-Sep-07 3:38
Russell'27-Sep-07 3:38 
GeneralRe: Urgent - How to identify given image is too dark or light Pin
Sreedhar DV27-Sep-07 23:02
Sreedhar DV27-Sep-07 23:02 
GeneralRe: Urgent - How to identify given image is too dark or light Pin
Russell'5-Oct-07 6:40
Russell'5-Oct-07 6:40 
AnswerRe: Urgent - How to identify given image is too dark or light Pin
KarstenK26-Sep-07 23:53
mveKarstenK26-Sep-07 23:53 
QuestionProblem with calling web service using HTTPSendRequest and InternetReadFile on EVC 3.0. Pin
HetalAgrawal26-Sep-07 20:37
HetalAgrawal26-Sep-07 20:37 
AnswerRe: Problem with calling web service using HTTPSendRequest and InternetReadFile on EVC 3.0. Pin
HetalAgrawal30-Sep-07 20:03
HetalAgrawal30-Sep-07 20:03 

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.