+ 3

Why compiler show monitered command dumped core?

19th Jan 2020, 2:31 PM
Roopam Maurya
Roopam Maurya - avatar
14 Antworten
19th Jan 2020, 3:28 PM
Roopam Maurya
Roopam Maurya - avatar
+ 3
Ipang thanks
19th Jan 2020, 4:35 PM
Roopam Maurya
Roopam Maurya - avatar
+ 2
Jayakrishna Ipang it results garbage value after making changes
19th Jan 2020, 3:57 PM
Roopam Maurya
Roopam Maurya - avatar
+ 2
19th Jan 2020, 4:33 PM
Roopam Maurya
Roopam Maurya - avatar
+ 2
Jayakrishna https://code.sololearn.com/c9icw7YY93I5/?ref=app 🙂 It wasn't possible without your help
19th Jan 2020, 4:35 PM
Roopam Maurya
Roopam Maurya - avatar
+ 1
Focus on <word> counting, garbage and error happens when <word> is 0. When calculating `avg = letter / word;` Print value of <letter> and <word> before calculating <avg> to see if it makes a valid/logical calculation. (Edit) The test for alphabets at line 12 still need correction, do as follows: if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z'))
19th Jan 2020, 4:05 PM
Ipang
0
Share the code, people can't help unless you show that code. Follow this guide on how to share links, in case you didn't know https://www.sololearn.com/post/74857/?ref=app
19th Jan 2020, 2:59 PM
Ipang
0
May be you are accessing a location which is not available, or uninitialized...
19th Jan 2020, 3:28 PM
Jayakrishna 🇮🇳
0
Roopam Maurya s[i]!='\0' causing that.. Instead of that use like i<strlen(s). And use one float or double variable for word or char... If both are Integer then int/int, you get again Integer value.. So you miss fraction part. And in loop, s[i] <= 'z' not > greater than.. Same in next comparition... Check out these...
19th Jan 2020, 3:45 PM
Jayakrishna 🇮🇳
0
Initialize <word> and <letter> at line 7, these are not automatically initialized to zero.
19th Jan 2020, 3:48 PM
Ipang
0
Roopam Maurya if(S[i] == ' ') Use single quotes for space comparition.. Edit: sorry, not needed a space to count as char.. I edited code below also.. I hope no further errors...
19th Jan 2020, 4:11 PM
Jayakrishna 🇮🇳
0
{ if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z')) { letter+=1; } if(s[i]==' ') { word+=1; } }
19th Jan 2020, 4:20 PM
Jayakrishna 🇮🇳
0
You're welcome Roopam Maurya
19th Jan 2020, 4:38 PM
Ipang
0
Roopam Maurya Wel come..
19th Jan 2020, 4:40 PM
Jayakrishna 🇮🇳