C typedef keyword tutorial example explained
#C #typedef #keyword
//typedef char user[25];
typedef struct
{
char name[25];
char password[12];
int id;
} User;
int main()
{
// typedef = reserved keyword that gives an existing datatype a "nickname"
User user1 = {"Bro", "password123", 123456789};
User user2 = {"Bruh", "password321", 987654321};
printf("%s\n", user1.name);
printf("%s\n", user1.password);
printf("%d\n", user1.id);
printf("\n");
printf("%s\n", user2.name);
printf("%s\n", user2.password);
printf("%d\n", user2.id);
return 0;
}
#C #typedef #keyword
//typedef char user[25];
typedef struct
{
char name[25];
char password[12];
int id;
} User;
int main()
{
// typedef = reserved keyword that gives an existing datatype a "nickname"
User user1 = {"Bro", "password123", 123456789};
User user2 = {"Bruh", "password321", 987654321};
printf("%s\n", user1.name);
printf("%s\n", user1.password);
printf("%d\n", user1.id);
printf("\n");
printf("%s\n", user2.name);
printf("%s\n", user2.password);
printf("%d\n", user2.id);
return 0;
}
- Category
- Bro Code
- Tags
- structure types, structure types in c, c programming structure types

Be the first to comment