/*program uses a function to add two
digits but function changes passed values before adding them*/
#include<stdio.h>
#include<conio.h>
int sum(int,int);
main()
{
int dig1,dig2,result;
dig1 =
10;
dig2
=5;
/*calling function and storing rturned value in variable
result*/
result
= sum(dig1,dig2);
printf("%d",result);
getche();
return 0;
}
/*Defining functions*/
int sum(int digi1, int digi2)
{
digi1 =2;
digi2 =3;
int add;
add =
digi1 + digi2;
return add;
}
No comments:
Post a Comment