怎么获取指针数组的值
如何获取指针数组的值
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];也不对,求高手指点!
------解决方案--------------------
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