Advertisement
d3dx939dll

Aula42 - Estruturas III

Jan 21st, 2021
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. struct horario{
  4.     int horas;
  5.     int minutos;
  6.     int segundos;
  7. };
  8. int main(void){
  9.     struct horario teste(struct horario x);
  10.  
  11.     struct horario agora;
  12.     agora.horas = 10;
  13.     agora.minutos = 30;
  14.     agora.segundos = 25;
  15.  
  16.     struct horario proxima;
  17.     proxima = teste(agora);
  18.  
  19.     printf("%i:%i:%i\n", proxima.horas,
  20.                          proxima.minutos,
  21.                          proxima.segundos);
  22.     return 0;
  23. }
  24. struct horario teste(struct horario x){
  25.  
  26.     printf("%i:%i:%i\n", x.horas,
  27.                          x.minutos,
  28.                          x.segundos);
  29.     x.horas = 05;
  30.     x.horas = 03;
  31.     x.segundos = 06;
  32.  
  33.     return x;
  34. }
  35.  
  36. //Sobre:
  37.  
  38. //Aula: Passar e Receber Estruturas à uma Função
  39. //Video: https://www.youtube.com/watch?v=9ycgQb8dGUg&t=2s
  40. //Data: 22/01/2021
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement