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 are the various types of control structures in programming?

809


What is include directive in c?

849


Hi can anyone tell what is a start up code?

1828


how can I convert a string to a number?

801


What are the different types of endless loops?

830


Why should I use standard library functions instead of writing my own?

965


hi send me sample aptitude papers of cts?

1868


Write a simple code fragment that will check if a number is positive or negative.

915


Do you know what are the properties of union in c?

791


What is static and volatile in c?

981


what is the role you expect in software industry?

1879


Why c is faster than c++?

806


What is sorting in c plus plus?

745


Write a program to use switch statement.

882


How to write a multi-statement macro?

823