Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / kurvatis

When a program starts its content copies from external
memory like a hard drive to a PROTECTED from writes part of
RAM. No any byte in that area can be changed!

Now the difference.
char * p = "this string is in protected memory and cannot be
changed";
You cannot change the string located in protected memory a
pointer points to.


char a[] = "this string is in memory that can be changed";

Theoretically char * p = "string"; eat less memory than
another one.

Is This Answer Correct ?    8 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to capitalise first letter of each word in a given string?

1929


The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference

1229


What is the difference between null pointer and wild pointer?

1198


Define and explain about ! Operator?

1002


What is a scope resolution operator in c?

1277


Why c language?

1077


What are inbuilt functions in c?

1037


What is difference between scanf and gets?

1278


How many types of operator or there in c?

1100


Are bit fields portable?

1159


Explain what header files do I need in order to define the standard library functions I use?

1173


How arrays can be passed to a user defined function

1024


Explain what is the general form of a c program?

1099


How can you allocate arrays or structures bigger than 64K?

1148


Why main function is special give two reasons?

1546