What is the difference between char a[] = "string"; and
char *p = "string"; ?

Answer Posted / ashwin kumar

just one word i can say that
a[] is static memory allocation ( we cant increase size of
array while execution of program )
*p is a dynamic memory allocation ( where we can use
according to our requirement while execution )

their may be a waste age of memory and also their may be
limitaion of elements in array.

memory will not be wasted and size depends up on our
require ment in pointes

i hope its may be one of the defferance

if thier is any feed back or my answer is wrong plz write
to molugu.aswin@gmail.com

Is This Answer Correct ?    6 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the best organizational structure?

644


Explain bitwise shift operators?

634


what are bit fields in c?

609


Define and explain about ! Operator?

617


What is register variable in c language?

609






In which language linux is written?

607


What is %d called in c?

763


How can I copy just a portion of a string?

820


HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????

2273


What are header files? What are their uses?

642


Explain a file operation in C with an example.

665


A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

637


Why does everyone say not to use scanf? What should I use instead?

682


Was 2000 a leap year?

635


What is difference between scanf and gets?

616