30 : Struct Tipinde Pointer
Bir struct değişkeni pointer olarak da tutulabilir. Bir önceki yazıda bir öğrenci bilgisi tutmayı görmüştük. Şimdi aynı kodda struct tipinde pointer kullanarak tekrar yazalım. #include <stdio.h> #include <string.h> typedef struct ogrenci { char ad[50]; char soyad[50]; int numara; float not; }ogrenci; int main() { ogrenci *ogrenci1 = malloc (sizeof(struct ogrenci)); ogrenci *ogrenci2 = malloc (sizeof(struct ogrenci)); if (ogrenci1 == NULL || ogrenci2 == NULL) { printf("Ogrenciler olusturulamadi \n"); return 0; } strcpy(ogrenci1->ad, "ad1"); strcpy(ogrenci1->soyad, "soyad1"); ogrenci1->numara = 55; ogrenci1->not = 3.5; strcpy(ogrenci2->ad, "ad2"); strcpy(ogrenci2->soyad, "soyad2"); ogrenci2->numara = 77; ogrenci2->not = 1.2; printf("Ogrenci 1 adi : %s \n", ogrenci1->ad); printf(...