Hi
Why is that wrong

#include<iostream>
#include<conio.h>
using namespace std;
struct Node
{
  char your_name;
  Node *link;
};
typedef Node* NodePtr;
class Q
{
  public:
         Q();
         void get_input( );
         void display_input( );
  private:
          NodePtr head;
};
int main()
{
  Q name;
  char your_name;
  cout<<"What is your name: ";
  name.get_input( );
  name.display_input( );
  
  getch();
  return 0;
}
Q::Q()
{
 cout<<"Your name is initialize to '/0'"<<endl;
 head=NULL;
}
void Q::get_input( )
{
  char temp[50];
  cin>>temp;   
  head= new Node;
  strcpy(head->your_name,temp);
  head->link=NULL;
}
void Q::display_input( )
{
  cout<<"Your name is equall to: ";
  cout<<head->your_name;
}

tghe error I have is :
46 C:\Documents and Settings\mauro\Desktop\c++\nodes- another simple example using an array of characters.cpp invalid conversion from `char' to `char*'

thx

line 7: your_name is a single character and you are attempting to use it as if it were a character array in line 41. Change the declaration in line 7 to be a character array.

Or, better yet, since this is a C++ program change it to be std::string class object, assuming your instructor will let you do that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.