简体   繁体   English

C中&(char *)的数据类型是什么?

[英]What is the datatype of &(char *) in C?

Suppose I have 假设我有

char *t = "XX";

I am wondering what is the type of &t. 我想知道&t是什么类型。 Is it char or array? 是char还是array?

由于t是指针, &t是指向指针的指针。

The type of &t for any expression is a pointer to the type of t . 任何表达式的&t类型都是指向t类型的指针。 In this case the type of t is char* hence the the type of &t is char** 在这种情况下, t的类型为char*因此&t的类型为char**

You need to know what a pointer is and who does it works. 需要知道什么是指针以及谁可以工作。

TYPE * VAR = VALUE;

Here you have: 这里您有:

  • TYPE : the type of data that you are storing TYPE :您要存储的数据类型
  • * : means it is a pointer of TYPE * :表示它是TYPE的指针
  • VAR : is the variable that store a pointer of TYPE VAR :是存储TYPE指针的变量
  • VALUE : value of TYPE VALUE :TYPE的值

And &VAR is a pointer to VAR . &VAR是一个指向VAR In your case VAR is a pointer also, so &VAR is a pointer to a pointer . 在您的情况下VAR也是一个指针,所以&VAR一个指针

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM