read a string

char name[10]; To read a string from keyboard.
what should i use :
this : cin>>name[10];

or this : cin>>*name;
Try cin >> name ;

name[10] is out of the bounds of the array, and *name is the first element (only) of the array.
aaaaah :)
that's right
I recommend cin >> setw(10) >> name;, otherwise you risk buffer overflow. (or just use strings)
Topic archived. No new replies allowed.