why is the output only 1 char?
1 2 3 4 5 6 7 8 9 10 11
|
int main()
{
char *Name,temp[80] ;
cout <<"Please key in the name" ;
cin.getline(temp,20,'\n') ;
Name = new char[strlen(temp)] ;
strcpy(Name,temp) ;
cout <<"\n" << *Name ;
system("pause") ;
return 0 ;
}
|
The title explains all XD....
Last edited on
Name is a char*.
*Name is a char. (It's the same as Name[0]).
Last edited on
Topic archived. No new replies allowed.