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

Write program to remove duplicate in an array?

589


Write a program to print ASCII code for a given digit.

677


What is #pragma statements?

581


how to introdu5ce my self in serco

1517


What is typedef?

657






What is keyword with example?

621


What does sizeof int return?

580


What are the keywords in c?

636


What are extern variables in c?

537


What is preprocessor with example?

572


How to write a code for reverse of string without using string functions?

1568


Is c a great language, or what?

594


Explain how can I remove the trailing spaces from a string?

616


What is the correct code to have following output in c using nested for loop?

603


Is c object oriented?

528