#include
typedef struct
{
int nim;
float ipk;
} Mahasiswa;
Mahasiswa m;
Mahasiswa *p =&m;
int main(){
//struk biasa
m.nim=4153;
m.ipk=3.40;
printf("nim=%d\n",m.nim);
printf("ipk=%f\n",m.ipk);
//Struct pointer
p->ipk=3.02;
p->nim=4188;
printf("nim=%d\n",p->nim);
printf("ipk=%f\n",p->ipk);
//mengacu pada variabel aslinya
printf("nim=%d\n",m.nim);
printf("ipk=%f\n",m.ipk);
return 0;
}
Tidak ada komentar:
Posting Komentar