Search code examples
cfunctionreturn-valueoutputstructured-programming

Difference in variable value inside and outside a function


I wrote a program in which I found the area of cylinder using a functionarea with a return-type and without parameters. answerwas returned to main function. However, I am getting different output in main and a different output in area. The decimal places seem to be replaced by 0 in the main function. Why is it so? enter image description here


Solution

  • Change the return type of area from int to float