(* char)和(char *)有什么区别? [英] What is the difference between(*char) and (char*) ?
本文介绍了(* char)和(char *)有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好
我想知道(* char)
和<$ c之间有什么区别$ c>(char *),(* float)
和(float *)
和simillars?
这些代码之间有什么区别:
Hi
I want to know is there any difference between (*char)
and (char*)
, (*float)
and (float*)
and simillars?
Also what is then difference between these codes :
int(*p)[3];
和
and
int *p[3];
谢谢!
Thank you !
推荐答案
据我所知(* char)
,(* float)
无效C
构造。
(char *)
和(float *)
用于分别转换为指向char的指针和指向float的指针,例如
As far as I know(*char)
,(*float)
are noty validC
constructs.
(char *)
and(float *)
are used to cast respectively to pointer to char and pointer to float, e.g.
char * pc = (char *) malloc( 100 );
char * pf = (float *) malloc( 100 * sizeof(float));
int(* p)[3];
声明 p
as 指向三个整数数组的指针:
int(*p)[3];
declares p
as a pointer to an array of three integers:
int(*p)[3];
int k[3] = {1,-2,0};
p = &k;
int * p [3];
声明 p
as 三个指向整数的指针数组:
int *p[3];
declares p
as an array of three pointers to integers:
int *p[3];
int i=5;
int j=7;
p[0] = &i;
p[1] = p[2] = &j;
这篇关于(* char)和(char *)有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文