I have this structure:
struct bye {
char b;
char y;
char e;
}
and I want to read with scanf a line that contains a word of 3 letters but between each other, there is the same unknown number of space.
For example: "b[n number of space]y[n number of space]e" and then put in:
struct bye word;
word.b = 'b' word.y = 'y' and word.e = 'e'
I did something like this but it doesn't work:
typedef struct bye bye_s;
bye_s setInput() {
bye_s ret;
char current_char;
scanf("%c", ¤t_char);
ret.b = current_char;
do {
scanf("%c", ¤t_char);
} while (current_char == ' ');
ret.y = current_char;
do {
scanf("%c", ¤t_char);
} while (current_char == ' ');
ret.e = current_char;
return ret;
}