Last active
August 17, 2017 14:10
-
-
Save mxmaxime/db37550e7b47491888b2d83febae0adf to your computer and use it in GitHub Desktop.
Silly struct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct Resultat { | |
char prenom[30]; | |
float note; | |
} Resultat; | |
typedef struct Ie { | |
char libelle[50]; | |
int coef; | |
Resultat resultats[2]; | |
} Ie; | |
int main() | |
{ | |
Resultat resulta1 = {"Maxime", 0}; | |
Resultat resultat2 = {"Roger", 20}; | |
Ie ie = { "Ceci est un troll", 40, { resulta1, resultat2}}; | |
printf("Résultat de l'ie %s coef %i \n", ie.libelle, ie.coef); | |
int i; | |
for (i = 0; i < 2; i++) { | |
Resultat r = ie.resultats[i]; | |
printf("L'étudiant %s a eu la note de %f \n", r.prenom, r.note); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment