Skip to content

Instantly share code, notes, and snippets.

@mxmaxime
Last active August 17, 2017 14:10
Show Gist options
  • Save mxmaxime/db37550e7b47491888b2d83febae0adf to your computer and use it in GitHub Desktop.
Save mxmaxime/db37550e7b47491888b2d83febae0adf to your computer and use it in GitHub Desktop.
Silly struct
#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