[Solved] return statement in c ??? why this function always returning 20?


You have a problem in your code. Change

scanf("%d",arr[i]);

To

scanf("%d",&arr[i]);

This is done because scanf expects an argument of type int* but you provide argument arr[i] which is of type int. Also add a check that ends the program if user inputs a number which is greater than 10 for the first scanf.

5

solved return statement in c ??? why this function always returning 20?