Hello. I've been relearning C++ for the past few days, and I've got this code written, and I'm getting an error, which I really don't understand.
Here's the code:
Here's the error:Code:// file "main.cpp" of project "testapp1" #include <iostream.h> #include <string> class clperson { public: char name1[25]; char name2[25]; int age; }; int initialize_clperson(char _name1[25], char _name2[25], int age, clperson *clperson1) { clperson1->name1 = _name1; clperson1->name2 = _name2; clperson1->age = (int)age; return(0); } int main(int argc, char *argv[]) { char name1[25]; char name2[25]; int age; clperson main_person; for (int i = 1; i < argc; ++i) { cout << "Argument " << i << " : " << argv[i] << '\n'; } cout << endl << endl; cout << "Welcome to my testing program! It will test functionality of\n"; cout << "different aspects of the C++ programming language.\n"; cout << endl << endl; cout << "Please enter your full name...\n"; cout << '>'; cin >> name1, name2; cout << endl << endl; cout << "Please enter your age...\n"; cout << '>'; cin >> age; initialize_clperson(name1, name2, age, &main_person); return(0); }
Does anybody know the solution to the problem? Thanks in advance.Code:C:\Program Files\Microsoft Visual Studio\MyProjects\testapp1\main.cpp(17) : error C2440: '=' : cannot convert from 'char []' to 'char [25]' There are no conversions to array types, although there are conversions to references or pointers to arrays



LinkBack URL
About LinkBacks


