Skip to content

Instantly share code, notes, and snippets.

@diogojorgebasso
Created July 11, 2022 03:34
Show Gist options
  • Save diogojorgebasso/58f7d73f8b19e41095f6f96a4b28cb92 to your computer and use it in GitHub Desktop.
Save diogojorgebasso/58f7d73f8b19e41095f6f96a4b28cb92 to your computer and use it in GitHub Desktop.
Struct com ponteiros
#include <stdio.h>
typedef struct{
char titulo[30], producao[20], dataCompra[8];
int temporada;
float preco;
}t_serietv;
int main(int argc, char *argv[]){
t_serietv *s1;
s1 = (t_serietv*) malloc(sizeof(t_serietv));
strcpy(s1->titulo,"Big Bang Theory");
s1->temporada = 3;
printf("%s esta na temporada %d \n",s1->titulo,s1->temporada);13
free(s1);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment