Archived

This topic is now archived and is closed to further replies.

Recommended Posts

its in a global struct:
struct SLinkedList{

Element *First_Element;
Element *Last_Element;
char *String_Temp;
String_Temp = /*new char*/ 0;

long number;
Element *Element_Temp;



} *linkedlist;

and it points to the line were it says:
String_Temp = /*new char*/ 0;
i have no idea :S

Share this post


Link to post
Share on other sites
What are you trying to do in the line "String_Temp = /*new char*/ 0;"? Can''t remember exactly, but I don''t believe you''re going to be able to initialize String_Temp inside of the struct like that. Instead, consider a constructor for it:


  
struct SLinkedList
{
Element *First_Element;
Element *Last_Element;
char *String_Temp;
long number;
Element *Element_Temp;

SLinkedList ( void )
{
String_Temp = 0;
}
} *linkedlist;

Share this post


Link to post
Share on other sites

String_Temp = /*new char*/ 0;

This is an executable line. It can''t go in a structure definition. If you want it to default to NULL you have to initialize it in a function someplace

Share this post


Link to post
Share on other sites
I don''t know 100% for sure, but I believe it''s done like this:


  
struct SLinkedList
{
SLinkedList():
String_Temp = 0;
{}

Element *First_Element;
Element *Last_Element;
char *String_Temp;
long number;
Element *Element_Temp;

SLinkedList ( void )
{
String_Temp = 0;
}
} *linkedlist;


Try it out and tell me(Not compiler ATM to test it myself)

*** Timeout Error ***

Sand Hawk

----------------
-Earth is 98% full. Please delete anybody you can.


My Site

Share this post


Link to post
Share on other sites
quote:
Original post by Johnny_Blaze93
its in a global struct:
struct SLinkedList{

Element *First_Element;
Element *Last_Element;
char *String_Temp;
String_Temp = /*new char*/ 0;

long number;
Element *Element_Temp;



} *linkedlist;

and it points to the line were it says:
String_Temp = /*new char*/ 0;
i have no idea :S


One other thing that hasn''t been mentioned, you can''t modify the value of String_Temp to 0 like you''re doing, that will make the String_Temp point to the system''s memory address 0.

"DaHjajmajQa''jajHeghmeH!"

Cyberdrek
danielc@iquebec.com
Founder
Laval Linux

/(bb|[^b]{2})/ that is the Question -- ThinkGeek.com
Hash Bang Slash bin Slash Bash -- #!/bin/bash

Share this post


Link to post
Share on other sites
Cyberdrek: Yes you can. 0 also indicates NULL pointer, or in other words, a pointer that is not in use.

Sand_Hawk: That won''t work.

What Melraidin wrote would work. But it doesn''t assign the value of pointer in construction phase.. Instead, this does:


struct Blah
{
char *String_Temp

Blah() : String_Temp(0) {}
};

Share this post


Link to post
Share on other sites