0
struct NodeType
{
  char name[MaxNameSize];              
  NodeType* next;                    // A pointer to the next person in line
};
 
void GetInLine(char new_person[]);
 
int main(void)
{
  char X[MaxNameSize];
  Q q1;
  q1.GetInLine("Joe");  
 
void Q::GetInLine(char new_person[]) // This function causes a person
                // to get in line in the appropria spot.

{
  NodeType* temp;
  temp=new NodeType;
  temp->name=new_person[];
  temp->next=Front;
  Front=temp;

}

my error in here is in a definition of GetInLine
139 C:\Documents and Settings\mauro\Desktop\ass4.cpp expected primary-expression before ']' token
What is that mean

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by Ancient Dragon
0

>> temp->name=new_person[];
Is that line 130? You can not assign char arrays like that. You have to use strcpy() instead, like this:

#include <cstring>
<snip>
strcpy(temp->name,new_person);

>> temp->next=Front;
>> Front=temp;

Circular reference -- is that what you really want ? It results in Front->next == Front, and you have lost all other nodes that may have been in that linked list.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.