C – Struct

#include <iostream>
using namespace std;

// Definisanje strukture
struct Student {
    string ime;
    int godine;
    float ocjene;
};

int main() {
    // Inicijalizacija strukture
    Student s1 = {"Lazar", 22, 4.5};

    // Pokazivač na strukturu
    Student* pokazivač = &s1;

    // Pristup podacima pomoću pokazivača
    cout << "Korištenje pokazivača:" << endl;
    cout << "Ime: " << pokazivač->ime << endl;
    cout << "Godine: " << pokazivač->godine << endl;
    cout << "Ocjene: " << pokazivač->ocjene << endl;

    return 0;
}