fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. typedef struct Atleta {
  5. float notas[5];
  6. } atleta;
  7. void receberNotas(atleta* l) {
  8. for (int i = 0; i < 5; i++) {
  9. printf("Digite %d nota: ", (i + 1));
  10. scanf("%f", &l->notas[i]);
  11. }
  12. }
  13. void mostrarNotas(atleta *l) {
  14. for (int i = 0; i < 5; i++) printf("\n%.2f", l->notas[i]);
  15. }
  16. int main() {
  17. atleta *a = malloc(sizeof(atleta));
  18. receberNotas(a);
  19. mostrarNotas(a);
  20. }
  21.  
  22. //https://pt.stackoverflow.com/q/155355/101
Success #stdin #stdout 0s 4504KB
stdin
1
2
3
4
5
stdout
Digite 1 nota: Digite 2 nota: Digite 3 nota: Digite 4 nota: Digite 5 nota: 
1.00
2.00
3.00
4.00
5.00