Hello I'm still a beginner in c++ or coding in general.So my lecturer didn't teach us about pointer.
so i search the internet and you would need to use char*
to call it.since I cannot use char*
I only can use char name();
char* name();// example for char* I want without *
char*name(){
char name[50];
cout<<"name:";
cin.getline(name,50);
return name;
}
int main(){
char staff[50];
strcpy(staff,name());
cout<<"name:"<<staff;
return 0;
}
How to return the name
to the main function without using char*
and use char();
(note that I could use reference but I don't know if char could use for it too).
Thanks in advance