After I enter first name then program fail.
Error: RUN FAILED (exit value 1, total time: 2s). I use Netbeans
#include <iostream>
using namespace std;
struct Student {
char * firstName;
char * lastName;
char * telephone;
};
void printStudent(Student s) {
cout << "Student info: " << endl;
cout << "Name: " << s.firstName << " " << s.lastName << ". Telephone: " << s.telephone << endl;
}
int main() {
Student s;
cout << "First name?" << endl;
cin.getline(s.firstName, 100);
cout << "Last name?" << endl;
cin.getline(s.lastName, 100);
cout << "Telephone?" << endl;
cin.getline(s.telephone, 100);
}