Skip to content

Instantly share code, notes, and snippets.

@emersxw
Created May 15, 2019 20:59
Show Gist options
  • Save emersxw/d94a04ea258f5882c2446095569c6322 to your computer and use it in GitHub Desktop.
Save emersxw/d94a04ea258f5882c2446095569c6322 to your computer and use it in GitHub Desktop.
A simple struct with char in c
#include <stdio.h>
#include <string.h>
// Definindo um struct para cartas de um baralho
struct carta {
char nome[101];
char valor[101];
int poder;
};
typedef struct carta carta;;
int main(int argc, const char * argv[]) {
carta nova[101];
nova[0].poder = 50;
strcpy(nova[0].nome, "Primeira");
strcpy(nova[0].valor, "Vale muito, caraio");
printf("Poder: %d\n", nova[0].poder);
printf("Nome: %s\n", nova[0].nome);
printf("Nome: %s\n", nova[0].valor);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment