| structures/baby-mother-father-struct-0.c - Introduktion af structures - sammenhørende data om en person. | Lektion 12 - slide 7 : 36 Program 2 |
#include <stdio.h>
typedef unsigned long int CPR;
struct person {
char *name;
CPR cpr, father_cpr, mother_cpr;
};
int main(void) {
struct person baby, mother, father;
baby.name = "Paul";
baby.cpr = 2304031577;
baby.father_cpr = 1605571233;
baby.mother_cpr = 2412671234;
mother.name = "Anna";
mother.cpr = 2412671234;
mother.father_cpr = 1605376789;
mother.mother_cpr = 1201402468;
father.name = "Frank";
father.cpr = 1605571233;
father.father_cpr = 1111331357;
father.mother_cpr = 1212358642;
printf("%s's mother and father is %s and %s\n",
baby.name, mother.name, father.name);
return 0;
}