由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - char[] 和 char*有什么区别?
相关主题
Dynamic buffer management question怎么得到char *分配空间的大小?
初学C,对什么该free一直搞不明白如何模拟实现thrashing?
free(char *)的问题 (转载)c question
奇怪的问题:关于一个简单的malloc()小程序 (转载)c++ 问题 (转载)
a=(char **)malloc(12*sizeof(char *)) 是什么意思?C pass string 问题
再问一个free()的问题问个c语言的问题
[-1] 什么意思?帮忙看看这几段程序有问题吗?
C里面一个被分配了内存的指针如何知道分配了多少?最新某公司onsite面试题 (转载)
相关话题的讨论汇总
话题: char话题: pointer话题: 区别话题: malloc话题: array
进入Programming版参与讨论
1 (共1页)
b*****n
发帖数: 2324
1
我一直以为是一样的,谁能说说有什么区别?
疑难问题一并问了。
s********s
发帖数: 4011
2
copy from comp.lang.c FAQ list, u can see more there.
An array is a single, preallocated chunk of contiguous elements (all of the
same type), fixed in size and location. A pointer is a reference to any data
element (of a particular type) anywhere. A pointer must be assigned to
point to space allocated elsewhere, but it can be reassigned (and the space,
if derived from malloc, can be resized) at any time. A pointer can point to
an array, and can simulate (along with malloc) a dynamically allocate
b*****n
发帖数: 2324
3
Thank you.
O*******d
发帖数: 20343
4
你可以用sizeof看看char[8]和char*的大小.
1 (共1页)
进入Programming版参与讨论
相关主题
最新某公司onsite面试题 (转载)a=(char **)malloc(12*sizeof(char *)) 是什么意思?
free(): invalid next size再问一个free()的问题
狠偷懒狠偷懒的一个测试[-1] 什么意思?
随手写的C程序,请指教C里面一个被分配了内存的指针如何知道分配了多少?
Dynamic buffer management question怎么得到char *分配空间的大小?
初学C,对什么该free一直搞不明白如何模拟实现thrashing?
free(char *)的问题 (转载)c question
奇怪的问题:关于一个简单的malloc()小程序 (转载)c++ 问题 (转载)
相关话题的讨论汇总
话题: char话题: pointer话题: 区别话题: malloc话题: array