Created
May 15, 2019 20:59
-
-
Save emersxw/d94a04ea258f5882c2446095569c6322 to your computer and use it in GitHub Desktop.
A simple struct with char in c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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