I have a list, but now I have to link it.
Here is my program ( I deleted code inside functions, to make my program more easy to read ).
#include <iostream> using namespace std; struct Student { char ime[16]; char priimek[16]; char vpisna[10]; char ocenaRV[10]; char ocenaDN[10]; char ocenaKV[10]; char ocenaVI[10]; Student *next; }; void clean(Student* pointer,int x) // Delete random data { } void dodajanje(int x,Student* s) // Add information about student { } void brisi(Student* pointer,int x) // Delete information about student { } int main() { int student,mesto, brisanje, ali = 0; cout << "Number of students?." << endl; cin >> student; Student* s = new Student[student]; clean(s,student); cout << endl; cout << "Add student to i place in array." << endl; cin >> mesto; dodajanje( mesto, s ); for(int i=0;i<(student*2);i++) { cout << "add student = 1, delete student = 2, cout information = 3"<<endl; cin>>ali; if (ali == 1) { cout << endl; cout << "Add student to i place in array." << endl; cin >> mesto; dodajanje( mesto, s ); } else if (ali == 2) { cout << "delete student on i place ?" << endl; cin >> brisanje; brisi(s,brisanje); } else { break; } } delete[] s; return 0; } Can someone explain me how to link my list, because code in all tutorials I came across was similar to this:
Node* temp = Node(); But in my program my code is:
Student* s = new Student[student]; And now I'm lost;
Note: I have to create dynamically linked list.