What is code for jungle camping ?it's not getting output. Plz solve | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
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; }

31st Dec 2019, 12:48 PM
Vishwesh Patel
Vishwesh Patel - avatar
2 ответов
+ 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')
31st Dec 2019, 1:11 PM
Arsenic
Arsenic - avatar
0
I would also suggest using the slightly cleaner switch statement - especially with short lines like these
31st Dec 2019, 2:24 PM
HNNX 🐿
HNNX 🐿 - avatar