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 Answers
+ 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