腾讯微群加入QQ群

 找回密码
 加入我们

!connect_header_login!

!connect_header_login_tip!

搜索
查看: 345|回复: 0

C指针

[复制链接]
发表于 2016-8-23 15:03:46 | 显示全部楼层 |阅读模式
#include<stdio.h>
#include<stdlib.h>


void fun(float *p3,float *p2,float *p1,float *s)

printf("var s address is %x\n",s);
printf("var p1 address is %x\n",p1);
printf("var p2 address is %x\n",p2);
printf("var p3 address is %x\n",p3);


    s=(float *)malloc(1*sizeof( float));
    printf("var s address is %x\n",s);


    printf("p2 values %f\n",*(p2++));
    printf("var p2 address is %x\n",p2);
    printf("p2 values %f\n",*p2);
    *s=*p1+*(p2++);
    printf("var p1 address is %x\n",p1);
    printf("var p2 address is %x\n",p2);
printf("var p3 address is %x\n",p3);


    printf("%f\n",*p1);
    printf("%f\n",*p1+*(p2++));
    printf("%f\n",*s);
}
int main()
{
    float a[2]= {1.1,2.2},b[2]= {10.0, 20.0},*s=a,c[2]={100.0,200.0};
printf("in the main function var s address is %x\n",s);
printf("in the main function var a address is %x\n",a);
printf("in the main function var b address is %x\n",b);
printf("in the main function var c address is %x\n",c);
    fun(c,b,a,s);
    printf("%f\n",*s);

}



0
0

转自:http://blog.csdn.net/ydwei918/article/details/17463437?locationNum=8
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

QQ|手机版|Archiver|小黑屋|一起疯|苦咖啡 ( 新ICP备12000197号  

GMT+8, 2018-1-17 05:13 , Processed in 0.049426 second(s), 12 queries , Memcache On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表