This program is designed to add three numbers, 1, 2, and 3. But when we run it, the program produces the result:
Sum is 1343432864
Why?
1 /************************************************
2 * sum_test -- Test the sum function *
3 ************************************************/
4 #include <stdio.h>
5
6 /************************************************
7 * sum -- Sum up three numbers *
8 * *
9 * Returns: The sum of the numbers. *
10 ************************************************/
11 int sum(i1, i2, i3)
12 {
13 int i1; /* The first number */
14 int i2; /* The second number */
15 int i3; /* The third number */
16
17 return (i1 + i2 + i3);
18 }
19
20 int main()
21 {
22 printf("Sum is %d\n", sum(1, 2, 3));
23 return (0);
24 }
25