#include<stdio.h>
#define OK 1
int prog6_2()
{
int a=3,b=4,sum=0;
int *pa,*pb,*psum;
char ch;
char *pch=&ch;
pa=&a;
pb=&b;
psum=∑
printf("指针变量的值:pa=%x pb=%x psum=%x\n",pa,pb,psum);
printf("目标变量的值:a=%d pb=%d sum=%d\n",*pa,*pb,*psum);
*psum=*pa+*pb;
*pch='A';
printf("运输结果;sum=%d\tch=%c\n",*(&sum),ch);
printf("整型指针变量的+运算:pa=%x pa+1=%x\n",pa,pa+1);
printf("字符型指针变量的+运算:pch=%x pch+1=%x\n",pch,pch+1);
return OK;
}
void prog7_1()
{
char c1,c2,c3;
printf("Input three characters:\n");
scanf("%c",&c1);
scanf("%c",&c2);
scanf("%c",&c3);
printf("c1=%c\tASCII=%d\n",c1,c1);
printf("c2=%c\tASCII=%d\n",c2,c2);
printf("c3=%c\tASCII=%d\n",c3,c3);
return OK;
}
int main()
{
prog6_2();
return OK;
prog7_1();
}
wangc958
相关分类