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
How is null defined in c?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?
What is typedef?
how to build a exercise findig min number of e heap with list imlemented?
Differentiate between static and dynamic modeling.
what do the 'c' and 'v' in argc and argv stand for?
how to make a scientific calculater ?
How can a program be made to print the line number where an error occurs?
How are portions of a program disabled in demo versions?
Explain about block scope in c?
Where static variables are stored in c?
How can you check to see whether a symbol is defined?
how to construct a simulator keeping the logical boolean gates in c
What is the difference between variable declaration and variable definition in c?