1
- 实际参数和形式参数的区别是什么?
实际参数(actual argument)是指调用函数时传递给形式参数的值,形式参数(formal parameter)是指在函数定义时括号内的值,是本函数私有的局部变量
2
a.void donut(int num)
b.int gear(int a,int b)
c.int guess(void)
d.void stuff_it(double a,double *pd)
3
char n_to_char(int a)
int digit(double a,int b)
double * which(double *pd1,double *pd2)
int random(void)
4 5
int sum(int a,int b){
return a + b;
}
double sum(double a,double b){
return a + b;
}
6 7
void alter(int *x,int *y){
int temp = *x + *y;
*x = temp;
*y = *x - 2 *(*y);
}
void salami(int num){
int count;
for (count = 1; count <= num; count++)
printf(" O salami mio ! \n");
}
8
int max(int a, int b, int c)
{
return a > b ? (a > c ? a : c) : (b > c ? b : c);
}
9
#include <stdio.h>
#include <stdlib.h>
void menu()
{
printf("Please choose one of the following: \n");
printf("1) copy files 2) move files \n");
printf("3) remove files 4) quit\n");
printf("Enter the number of your choice:");
}
int limit(int a, int b)
{
int num;
while(scanf("%d", &num) == 1)
{
if(num >= a && num <= b)
{
return num;
}
else
{
menu();
}
}
return 4;
}
int main(void)
{
int a, b;
scanf("%d %d", &a, &b);
int x = limit(a, b);
printf("\nXXXX%d\n", x);
return 0;
}