hello everyone i'm new ic and i have a problem on structs, on the very simple
i want to create a struct with one int and a char table 3 potisions,this is my code
#include <stdio.h>
#include <string.h>
#include <conio.h>
struct domi
{
int code;
char name[3];
};
main()
{
struct domi don;
int i;
printf("Dwse times gia ta meloi tis domis ");
scanf("%d",&(don.code));
for (i=0;i<3;i++)
{
// don.name[i]=getchar();
scanf("%c",&(don.name[i]));
}
printf("Oi times pou dwsate einai: %d kai ",don.code);
for (i=0;i<3;i++)
{
printf("%c",(don.name[i]));
}
}
i want to put on my keyboard the values 5 a b c and it should be the output
5
a
b
c
but it didn't any idea?
thanks