I am new to the world of structures and pointers, and was trying to use a modified version of the program example given in the structures tutorial. Every time I try to run it, it crashes. Any advice?
Code:#include <iostream> using namespace std; struct database { int id_number; int age; float salary; }; int main() { database employee; database *ptr,*ptr1,*ptr2; employee.age=28; employee.id_number=1; employee.salary=12000.21; cout<<ptr->age; cout<<ptr1->id_number; cout<<ptr2->salary; cin.get(); }



LinkBack URL
About LinkBacks


