求c语言大神帮忙编下简单的指针实验题,求源程序代码

如题所述

//刚写的,测试过满足题目要求,有问题欢迎交流
#include<stdio.h>

int main(){

int a, c = 3;
float b;
int *p;
float * q;
p = &a;
q = &b;
printf("Please Input the Value of a, b: ");
scanf("%d, %f", &a, &b);
printf("Result:\n");
printf("\t%d, %f\n", a, b);
printf("\t%d, %f\n", *p, *q);
printf("The Address of a, b: %X, %x\n", &a, &b);
printf("The Address of a, b: %X, %x\n", p, q);
p = &c;
printf("c=%d\n", *p);
printf("The Address of c: %X, %X\n", &c, p);
return 0;
}

温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-12-11
#include<stdio.h>
void main()
{ int a,*p,c;
float b,*q;

p=&a; q=&b; c=3;
printf("Please Input the Value of a, b: "); scanf("%d%f",&a,&b);
printf("Result:\n\t%d, %f\n\t%d, %f\n",(*p),(*q),a,b);
printf("The Address of a, b: %x, %x\nThe Adress of a, b: %x, %x\n",p,q,&a,&b);
p=&c; printf("c=%d\n",(*p));
printf("The Address of c: %x, %x\n",p,&c);

}
第2个回答  2014-12-11
#include <stdio.h>

int main()
{
int a=0;
float b=0;
int *p = &a;
float *q = &b;
int c = 3;

printf("Please Input the Value of a,b:");
scanf("%d %f",p,q);

printf("Resault:\r\n\t%d,%f\r\n",a,b);
printf("\t%d,%f\r\n",*p,*q);
printf("The Address of a,b:%.8x,%.8x\r\n",&a,&b);
printf("The Address of a,b:%.8x,%.8x\r\n",p,q);

p = &c;
printf("c=%d\r\n",*p);
printf("The Address of c:%.8x\r\n",p);

return 0;
}
第3个回答  2014-12-11
你用什么软件追问

visual c++6.0

相似回答