/* penggunaan pointer dan struct Aang Samsudy-0910680001 */ #include<stdio.h> #include<conio.

h> struct motor { float volts; float amps; struct motor *next; }; typedef struct motor motor; int main() { motor m1, m2, m3; m1.volts=1; m1.amps=2; m2.volts=3; m2.amps=4; m3.volts=5; m3.amps=6; m1.next=&m2; m2.next=&m3; m3.next=NULL; //melihat isi m2 dengan m1 printf("melihat isi m2 lwt m1:\n voltase m2:%0.2f\n amps:%0.2f\n\n",m1.next-> volts,m1.next->amps); //melihat data m3 lewat m2 printf("melihat isi m3 lwt m2:\n voltase m3:%0.2f\n amps m3:%0.2f\n\n",m2.nex t->volts,m2.next->amps); //melihat data m3 lewat m1 printf("melihat isi m3 lwt m1:\n voltase m3:%0.2f\n amps m3:%0.2f\n\n",m1.nex t->next->volts,m1.next->next->amps); getch();}

Sign up to vote on this title
UsefulNot useful