I'm trying to make a function that checks a string arguement and depending on the string changes it and returns it. So they would enter say their name into char name[10] which would then be put into a function that checks if the name is Stinky if so it would change it to ryan.
heres what I have tried.
It comes up with two errors:Code:#include <iostream.h> #include <stdio.h> #include <conio.h> char name[10]; char check(char* name_check) { if(name_check == "Stinky") { name_check = "Ryan"; } else { name_check = "Not Ryan"; } return name_check; } int main() { cout<<"Enter your name: "; cin.getline(name, 10); name=check(name); return 0; }
! Error E2034 .\test.cpp 19: Cannot convert 'char *' to 'char' in function * check(char *)
! Error E2277 .\test.cpp 26: Lvalue required in function main()



LinkBack URL
About LinkBacks



