+ 1

I am stuck in a problem while solving jungle camping example in c, can anyone please solve this issue? Here is my code:

#include <stdio.h> #include <string.h> int main() { int i,c,j; char a[c]; char l[]="Grr"; char t[]="Rawr"; char s[]="Ssss"; char b[]="Chirp"; for(i=0;i<c;i++){ scanf("%s",&a[i]); } for(j=0;j<c;j++){ if(a[j]==l){ printf("Lion "); } if(a[j]==t){ printf("Tiger "); } if(a[j]==s){ printf("Snake "); } if(a[j]==b){ printf("Bird "); } } return 0; }

18th May 2020, 1:42 PM
Abhishek Shivade
2 odpowiedzi
0
We wont solve it for you, but we can help YOU to solve it... In second line of main you wrote: char a[c], but c is not initialized yet.
18th May 2020, 1:50 PM
Alexander Thiem
Alexander Thiem - avatar