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 are the advantages of c language?

675


a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.

4551


Explain how can you tell whether a program was compiled using c versus c++?

595


How is a structure member accessed?

594


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

1607






What is difference between main and void main?

641


Where can I get an ansi-compatible lint?

654


What is union and structure in c?

632


What is a char in c?

561


Explain how do you declare an array that will hold more than 64kb of data?

915


How do you print an address?

758


Where local variables are stored in c?

565


How do you override a defined macro?

711


What is the difference between declaring a variable by constant keyword and #define ing that variable?

2722


Which type of language is c?

660