This is a part of a bigger program, but what is driving me crazy is the fact that the program doesn't wait for something to be read from stdin in the string s (it just puts null in string s) , but if I put the read of the string s first and afterwards I read the character c the program works just fine. The thing is I need to read the data in this specific order. How can i fix it?
char s[100],c;
printf("enter character:\n");
c=getchar();
printf("enter string text:\n");
fgets(s,101,stdin);
uint8_t s_len = strlen(s) - 1;
s[s_len] = '\0';
printf("i have read %s\n",s);