What is the difference between char a[] = "string"; and
char *p = "string"; ?
Answer Posted / aravind
hi im answering as far as i know , pls say ur feedback,,,(+_+)
Array:
for char array char a[]; no such array size is accepted by
the compiler. That is , it requires a fixed size for the
array like: char a[20];
in this case the number of strings / characters it can hold
is only upto 20 while if it exceeds , the input strings get
truncated. [STATIC MEMORY ALLOCATION AND TRAVERSAL WITHIN
BOUNDS]
Pointer:
Whereas in case of pointers it is of DYNAMIC MEMORY type and
infinite storage when compared to Array. and predefinition ,
truncation are absent.
Also TRAVERSAL is easy.
| Is This Answer Correct ? | 6 Yes | 23 No |
Post New Answer View All Answers
what type of questions arrive in interview over c programming?
How can you avoid including a header more than once?
all c language question
Why c is procedure oriented?
When was c language developed?
What is the heap?
What is the size of array float a(10)?
In C, What is the #line used for?
Difference between MAC vs. IP Addressing
What is difference between constant pointer and constant variable?
What is dynamic dispatch in c++?
What is wrong with this program statement?
How do we open a binary file in Read/Write mode in C?
Explain the use of fflush() function?
How do I use strcmp?