0
What is code for jungle camping ?it's not getting output. Plz solve
#include <stdio.h> #include<string.h> int main() { int i; char Sound[4]; char Grr,Rawr,Ssss,Chirp; for(i=0;i<=3;i++) { scanf("%s",Sound[i]); } for(i=0;i<=3;i++) { if(Sound[i]==Grr) { printf("Lion"); } else if(Sound[i]==Rawr) { printf ("Tiger"); } else if(Sound[i]==Ssss) { printf ("Snake"); } else if(Sound[i]=Chirp) { printf ("Bird"); } } return 0; }
2 Respostas
+ 2
The problem is that you are comparing value at sound[i] with some random variables all the time.
All the character variables have not been assigned any value
for compillar Grr is just like any other variable (say'x')
0
I would also suggest using the slightly cleaner switch statement - especially with short lines like these