首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

怎么获取指针数组的值

2012-03-29 
如何获取指针数组的值char*p[512]intnCount512for(intin0innCountin++){p[in]strtok(buf, ,)bu

如何获取指针数组的值
                  char   *p[512];
int   nCount=512;
for   (int   in   =   0;in   <   nCount;in++)
{
p[in]=strtok(buf, ",   ");
buf   =   NULL;
                                    float   yy=p[in];//这里我要获取指针数组的值
                  }
请教如何获取指针数组的值呢?写成float   yy=*p[in];也不对,求高手指点!

[解决办法]

C/C++ code
    char buf[]="1.2 2.3,4.5";    char *p[512];    int in,nCount=512;    float yy;    char *b;        b=buf;    for (in=0;in<nCount;in++) {        p[in]=strtok(b, ", ");        if (NULL==p[in]) break;        b=NULL;        sscanf(p[in],"%f",&yy);        printf("in,yy=%d,%g\n",in,yy);    }//in,yy=0,1.2//in,yy=1,2.3//in,yy=2,4.5 

热点排行