请告诉我区别 [英] plz tell me the difference

查看:68
本文介绍了请告诉我区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

char * a ="这是一个字符串" ;;

char a [] ="这是一个字符串" ;;

首先是指针而第二个是是一个数组。告诉我更多的差异

char *a="this is a string";
char a[]="this is a string";
first is a pointer while second is an array.Tell me more differences

推荐答案



" jeniffer" <泽****************** @ gmail.com>在消息中写道

news:11 ********************** @ j33g2000cwa.googlegr oups.com ...

"jeniffer" <ze******************@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
char * a ="这是一个字符串" ;;
char a [] ="这是一个字符串" ;;
首先是指针而第二个是数组。告诉我更多差异
char *a="this is a string";
char a[]="this is a string";
first is a pointer while second is an array.Tell me more differences




问题1.32和6.2及其答案应该有所帮助。如果没有,请告诉我们为什么

没有。
http: //www.c-faq.com

Rod Pemberton



Questions 1.32 and 6.2 and their answers should help. If not, tell us why
not.
http://www.c-faq.com
Rod Pemberton


char * a声明指向字符串的指针。因此,要说char * a =这是

一个字符串,将字符串的第一个字母的地址放入

指针a。所以,首先是t。位于内存的某处,

指针包含地址。
char *a declares a pointer to a string. So, to say char *a = "this is
a string", puts the address of the first letter of the string into the
pointer a. So, that first "t" is located somewhere in memory, the
pointer a contains the address.
char * a ="这是一个字符串" ;;
char *a="this is a string";



如果你写了printf(" char =%d",a);你会看到地址

其中a已存储

如果你写了printf(char =%c,* a);你会看到该地址有什么价值




flank


If you wrote printf("char = %d",a); you would see the address
where a has been stored
If you wrote printf("char = %c",*a); you would see what value was
at that address.

flank




" char * a ="这是一个字符串"

这里是字符串文字"这是一个字符串存储在数据中

segment&你正在使指针变量a指向这个位置

但是a可以更改为指向程序中的任何其他位置。


char a [] ="这是一个字符串" ;;


但是在这里你不能改变变量a的指针。到程序中的其他

位置。


i希望这对你有帮助....


jeniffer写道:

"char *a="this is a string"
Here the string literals " this is a string " is stored in data
segment & you are making pointer variable "a" to point this location
but "a" can be changed to point to any other location in a program.

char a[]="this is a string";

but here you can''t change pointer of the variable "a" to other
location in the program.

i hope this help you....

jeniffer wrote:
char * a ="这是一个字符串" ;;
char a [] ="这是一个字符串" ;;
首先是指针而第二个是数组告诉我更多的差异
char *a="this is a string";
char a[]="this is a string";
first is a pointer while second is an array.Tell me more differences






这篇关于请告诉我区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆