C语言|CS代写 – Pointer Exercise

C语言|CS代写: 这是简单的C指针联系

Pointer Exercise

1. Write a C program that prompts the user to enter 5 numbers and adds each number to a total.

The program should then display the total. To add to the total, the program must call the
function void sum(int value, int *ptotal) passing the value the user entered and the address of
the total (a local variable in main). The function should add the value to the total. Note that the
function is void and does not return anything. Don't forget to initialize the total to  0  in main.

2. Modify the previous program to get the value by calling the function void GetValue(int *pvalue)

for each of the  5  values entered by the user. The program should still call the sum function to

calculate the sum and should still display the total.

发表评论

电子邮件地址不会被公开。 必填项已用*标注