Newb Question - Cant convert Char[41] to Char
Hi All,
I am new to this forum and to C++ programming. But still I have managed my program to error :p.
Can someone tell me what is wrong with this code?!
Code:
void main()
{
char User[UserMaxLength];
print_header();
User = get_user();
printf("%s@!localhost [#]", User);
return;
}
char get_user()
{
char Temp[UserMaxLength];
scanf("Gebruikersnaam: %s", &Temp);
return Temp;
}
The error I get is:
Code:
C:\Program Files\Microsoft Visual Studio\MyProjects\Kernel\KK006b\KK006b.cpp(16) : error C2440: '=' : cannot convert from 'char' to 'char [41]'
There are no conversions to array types, although there are conversions to references or pointers to arrays
C:\Program Files\Microsoft Visual Studio\MyProjects\Kernel\KK006b\KK006b.cpp(31) : error C2440: 'return' : cannot convert from 'char [41]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Any help would be greatly appreciated
Kalkran