hi
My question is: I have a struct which is called Pet. data members name,type,age and a pointer variable nextPet.
I must write a function that dynamically creats a new node for a Pet object. The function should ask to user to enter in the information for all data members of the node, and assign NULL to the nextPet data member. I wrote but it gives a error.
here is the program...
#include <iostream>
struct Pet
{
char name;
char type;
int age;
node *nextPet;
};
int main( )
{
Pet *nextPet;
nextPet=new Pet;
cout<<"please write name"<<endl
cin>>nextPet->name;
cout<<"please write animal type"<<endl;
cin>>nextPet->type;
cout<<"please write age<<endl;
cin>>nextPet->age;
root->next=NULL;
RETURN 0;
}
pls help...thnks