my input is just normal number and name like "12345", "Joe", but the output got all weird number like -2743443232 and \300\230\340,
using namespace std;
struct student{
int Id;
string name;
};
void display(student *x){
int i;
for( i=0; i<5; i++){
cout<<"student id : "<<x->Id<<endl;
cout<<"student name : "<<x->name<<endl;
}
}
int main(){
student stu[5];
int i;
for( i=0; i<5; i++){
cout<<"enter the student id ";
cin>>stu[i].Id;
cout<<"enter the name of student : ";
cin>>stu[i].name;
}
display(&stu[5]);
return 0;
}