0

C language

I want to write a code which calculates the variance of 5 numbers I wrote this but it doesn’t work Do you know what is the problem?! https://code.sololearn.com/cZPq6Pu8hfj9/?ref=app

20th Dec 2019, 2:27 PM
Laya Mousavi
5 Respostas
+ 1
In function f(), you are not declared values for a, b, c, d, e. So it take some garbage values. First need to give values to those. And in main function, f(), functions variables are completely different. There scope is local. So it is available outside of their functions... If you make those variables as global, then variables are available through out program in all functions..
20th Dec 2019, 2:37 PM
Jayakrishna 🇼🇳
0
put this above int main to be global : float a,b,c,d,e,x,answer remove this line in the f function.: float a,b,c,d,e
20th Dec 2019, 2:37 PM
Bahha┣
Bahha┣ - avatar
0
float a,b,c,d,e are not initialized. They are holding garbage value which result undefined behavior. Put the input numbers into the function.
20th Dec 2019, 2:42 PM
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż - avatar
0
bahha🐧 CarrieForle Jayakrishna thanks all of youđŸ’ƒđŸ»đŸ’ƒđŸ»đŸ’ƒđŸ»
20th Dec 2019, 2:47 PM
Laya Mousavi
0
CarrieForle would you help me with my last question?!😱
20th Dec 2019, 5:17 PM
Laya Mousavi