[求助]程序改错
1: /* Program to calculate the product of two nmbers. */2: #include <stdio.h>
3:
4: int val1,val2,val3;
5:
6: int product(int x,int y);
7:
8: int main(void)
9: {
10: /* Get the first number */
11: printf("Enter a number between 1 and 100:");
12: scanf("%d",&val1);
13:
14: /* Get the second number */
15: printf("Enter another number between 1 and 100:");
16: scanf("%d",&val2);
17:
18: /* calculate and display the product */
19: val3=product(val1,val2);
20: printf("%d times %d = %d\n",val1,val2,val3);
21:
22: return 0;
23: }
24:
25: /* Function returns the product of the two values provided */
26: int product(int x, int y)
27: {
28: return (x * y);
29: }
问题:
A、22行中,return 0可否改为return?为什么要将0返回给操作系统;
B、第6行和26行是否起同样的作用?可否不需要第26行?
请高手们指点指点啊