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
*a=”String”

Answer Posted / anshul

I guess the main difference for which interviewer was looking for it that name of the array is constant pointer and character pointer is not. So, if
char a1[]="string";
char *a2="string";

a2=a1;//Compiles and works perfectly
a1=a2;//Error caught at compile time

This is a famous example and is available in many C books.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is stoi in c++?

1185


Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .

1149


What are maps in c++?

967


write a porgram in c++ that reads an integer and print the biggest digit in the number

2259


Explain how a pointer to function can be declared in C++?

1066


Can we define a constructor as virtual in c++?

1129


List the merits and demerits of declaring a nested class in C++?

1032


What is the meaning of c++?

1029


How does class accomplish data hiding in c++?

1182


which of the following is not an secondary constant a) array b) real c) union

1806


Differentiate between a constructor and a destructor in c++.

1019


How the programmer of a class should decide whether to declare member function or a friend function?

1121


When should overload new operator on a global basis or a class basis?

1081


Is java made in c++?

1069


what are the decision making statements in C++? Explain if statement with an example?

1099