// 191.c
#include
int max(int a,int b)
{
return a>b?a:b;
}
int min(int a,int b)
{
return a>b?b:a;
}
int fun(int a,int b,int (*p)())
{
return p(a,b);
}
void main()
{
int a=3,b=2,(*p)();
printf("%d",fun(a,b,min));
getch();
}
// 192.c
#include
char *fun(char a[],int n)
{
return a+n-1;
}
void main()
{
char a[]="blacksheepwall";
printf("%s",fun(a,2));
getch();
}
// 193.c
#include
void main()
{
char *a[]={"how","do","you","turn","this","on"},i,j,*p;
for(i=0;i<5;i++)
for(j=i+1;j<6;j++)
{
if(strcmp(a[i],a[j])>0)
{
p=a[i];a[i]=a[j];a[j]=p;
}
}
for(i=0;i<6;i++)
puts(a[i]);
getch();
}
// 194.c
#include
void main()
{
char *a[]={"how","do","you","turn","this","on"},**p,**q,*t;
for(p=a;p0)
{
t=*p;*p=*q;*q=t;
}
}
for(p=a;p
// 195.c
#include
#include
void main()
{
int i,j,*p,*q;
p=(int *)malloc(sizeof(int));
*p=1;
printf("%3d\n",*p);
for(i=1;i<10;i++)
{
q=p;
p=(int *)malloc(sizeof(int)*(i+1));
for(j=0;j
// 196.c
#include
#include
void main()
{
int i,j,*a[10];
for(i=0;i<10;i++)
a[i]=(int *)malloc(sizeof(int)*(i+1));
for(i=0;i<10;i++)
for(j=0;j<=i;j++)
if(j==0||i==0||i==j)a[i][j]=1;
else a[i][j]=a[i-1][j-1]+a[i-1][j];
for(i=0;i<10;i++,printf("\n"))
for(j=0;j<=i;j++)
printf("%3d",a[i][j]);
getch();
}
// 197.c
#include
#include
void fun(int n)
{
int **p,i,j;
p=(int **)malloc(sizeof(int)*n);
for(i=0;i
// 198.c
#include
#include
void fun(int n)
{
int **p,i,j,**q;
p=(int **)malloc(sizeof(int));
**p=1;
printf("%5d",**p);
for(i=1;i
// 199.c
#include "123.c"
void main()
{
int a;
a=6;
printf("%d",a);
getch();
}
// 200.c
#include
//编译预处理重在预字
//预处理过程在编译之前已经完成
#define M 5
#define N M*M
void main()
{
printf("%d",N);
getch();
}