There are two int variables: a and b,
don't use "if","?:","switch" or other judgement statements, find
out the biggest one of the two numbers.
解析:1. int max=((a+b)+abs(a-b)))/2; 2. int
c=a-b; char*
strs[2]={"a大","b大"};
c=unsigned(c)>>(sizeof(int)*8-1);
What does the keyword "const" mean in C
program ? Please at least make two examples about the usages of
const.
答:在C程序中,const的用法主要有定义常量,修饰函数参数,修饰函数返回值等3个用处。在C++中,它还可以修饰函数的定义体,定义类中某个成员函
数为恒态函数,即不改变类中的数据成员。被const修饰的东西都受到强制保护,可以预防意外的变动,提高程序的健壮性。