Error 1 error C2440: '=' : cannot convert from 'char []' to 'char [25]'?

My program will not compile. I am assuming it has something to do with the character array, but I cant seem to figure it out.

Please help!

#include
#include

using namespace std;

struct noahark
{
int count;
mutable char word[25];
double charge;
noahark *link; //pointer to the next record

};

noahark * HeadPointer = NULL;

//Declare function prototypes:

void InsertItem ( int, char[], double, noahark * );
void PrintList (noahark * );

int main ( )
{
int InitCount = 0;
char InitWord [25]= "\0";
double InitCharge = 0;

noahark * CurrentRecordPointer = NULL;

char NextChar = '\0';
char ContinuationFlag = 'Y';

while ( toupper (ContinuationFlag) == 'Y' )
{
cout << "ID Number of the animal: " << endl;
cin >> InitCount;

cout << "Name of the animal: " << endl;

NextChar = cin.peek();

if ( NextChar == '\n' )
{
cin.ignore( );
}
cin.get ( InitWord, 24 );

cout << "Charge Fee of the Animal: " << endl;
cin >> InitCharge;

CurrentRecordPointer = new noahark;

//call the function to create the Linked List.

InsertItem( InitCount, InitWord, InitCharge, CurrentRecordPointer );
//demotes CurrentRecordPointer to HeadPointer
HeadPointer = CurrentRecordPointer;

cout << "Do you wish to enter any more items?" << endl;
cin >> ContinuationFlag;

} //end of while loop

//call display function

PrintList ( HeadPointer );
system("pause");
return 0;
}//end of main

void InsertItem ( int InitCount, char InitWord[], double InitCharge, noahark * CurrentRecordPointer)
{
CurrentRecordPointer->count = InitCount;
CurrentRecordPointer->word = InitWord;
CurrentRecordPointer->charge = InitCharge;
CurrentRecordPointer->link = HeadPointer;
}
void PrintList ( noahark * Head )
{
while ( Head != NULL )
{
cout << Head->count << " " << endl;
cout << Head->word << " " << endl;
cout << Head->charge << " " << endl;
Head = Head->link; //gets us to the next record
}
}


More on hypeanswer.com

    More on Wikipedia

    Answers

      News