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

Differentiate between a for loop and a while loop? What are it uses?

930


An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array

918


Where can I get an ansi-compatible lint?

900


Are pointers integers in c?

828


Why can’t we compare structures?

1051


What happens if a header file is included twice?

809


write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.

5224


the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b

2383


An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above

934


Which is better pointer or array?

805


What is getche() function?

819


How do I determine whether a character is numeric, alphabetic, and so on?

877


How does pointer work in c?

844


How does free() know explain how much memory to release?

821


a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above

999