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 / sushant mahajan

Ohk... dudes I think that 'C' in Char a[] is a typo. The only difference I can see is this:

char *a="string";
printf("%d", sizeof(a));
/*will print 2 or 4, whatever is the memory assigned to a pointer*/

char a[]="string";
printf("%d", sizeof(a));
/*will print 7 - 1 byte for each character+1 byte for the '\0' */

So basically its a memory thing :D

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is bubble sort c++?

1003


Explain about vectors in c ++?

1023


What is c++ redistributable?

1227


When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?

1093


Who calls main function?

1109


What is the arrow operator in c++?

1016


How does code-bloating occur in c++?

1197


Is it possible to provide special behavior for one instance of a template but not for other instances?

1128


What do you mean by enumerated data type?

1049


What is the use of setfill in c++?

1074


Do class declarations end with a semicolon? Do class method definitions?

1147


Explain the use of this pointer?

1156


Explain deep copy and a shallow copy?

1059


Can you explicitly call a destructor on a local variable?

1028


Give 10 points of differences between C & C++.

1140