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 syallabus of computer science students in group- 1?

1833


Write a program to reverse a given number in c language?

616


Discuss the function of conditional operator, size of operator and comma operator with examples.

676


What are register variables? What are the advantage of using register variables?

676


If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?

774






How do I get an accurate error status return from system on ms-dos?

640


Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.

3118


Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)

600


What does stand for?

590


please send me the code for multiplying sparse matrix using c

1718


Is null always defined as 0(zero)?

610


What is floating point constants?

684


Describe the steps to insert data into a singly linked list.

617


What is masking?

631


What does static variable mean in c?

646