Hello,I'm learning C and I've got a question. what is wrong with my code? I expect that the users enter sunny, cloudy, rainy and the program to pick the first letter. Then with that first letters fo to swit function and print.
Code:#include <stdio.h> #define TAMANIO 10 void swit(char st[TAMANIO]); int main () { int i; char str[TAMANIO]; printf("Enter your weather - sunny - cloudy- rainy: \n"); for (i = 0;i < TAMANIO ;i++ ){ scanf("%s",&str[i]); if (str[i] == EOF) { i = (TAMANIO -1); } //IF user enter eof breaks the for cycle. } swit(str[0]); } void swit(char st[TAMANIO]) { switch (st[0]) { case 's': printf("pick up your sunscreen: "); break; case 'c': printf("pick up your jacket"); break; case 'r': printf("pick up your umbrella"); break; default: printf("wrong weather! "); break; }//end swith }