what is the difference between these initializations?
Char a[]=”string”;
Char *p=”literal”;
Does *p++ increment p, or what it points to?

Answer Posted / gaurav

I am totally satisfied with your above explanation except
last one.
i.e. Char *p="literal";
So, i want to mention yes this will work.
Explanation: *p++.
Here we have post increment.
Postfix increment/decrement have high precedence, but the
actual increment or decrement of the operand is delayed (to
be accomplished sometime before the statement completes
execution).
value of printf("\nstr=%c\n",*p++) will be 'l', but before
complete execution of this statement p will point to string
"iteral" as p got incremented.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a local variable be volatile in c?

579


What is sizeof int?

639


How is a pointer variable declared?

595


What is character constants?

715


Write a program to reverse a given number in c?

602






What is call by reference in functions?

569


An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above

648


what do you mean by inline function in C?

619


What is extern storage class in c?

514


What is a structure and why it is used?

621


Iam a B.Tech graduate and completed my engineering in 2009, from 2005 to 2009 and after that i had done nothing.Now i want to do job and get into BPO field . Friends give me suggestions as what to say in interview... if they ask me that what would you had done ... these many years without doing job ??????? pls urgent

1432


There seem to be a few missing operators ..

620


What is a good way to implement complex numbers in c?

597


What is a const pointer?

638


Explain how does flowchart help in writing a program?

634