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 these initializations?
Char a[]=”string”;
Char *p=”literal”;
Does *p++ increment p, or what it points to?

Answer Posted / bee

logically, both are treated as array of characters(i.e.
string) but....

1) a is an array of characters(a string)

2) p is a pointer to an array of characters
the statement char *p = "literal" is equivalent to
char j[] = "literal"
char *p = j;
3) *p++ can be seen as *(p++)....
this is so because '++' has higher recedence over '*'
operator. so, it increments address by 1 unit and prints
the corresponding value value

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What's the right way to use errno?

1149


What is difference between union and structure in c?

1166


What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?

1060


What are the different types of linkage exist in c?

1033


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1995


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

1108


What is dangling pointer in c?

1238


Which is more efficient, a switch statement or an if else chain?

1027


What is the code in while loop that returns the output of given code?

1996


What are conditional operators in C?

1100


Differentiate fundamental data types and derived data types in C.

1036


write a program to generate address labels using structures?

4577


What Is The Difference Between Null And Void Pointer?

1259


Why is c so popular?

1163


How many header files are in c?

1038