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
What is c programing language?
Explain what is a static function?
Is a house a mass structure?
#include
number of times a digit is present in a number
Can you mix old-style and new-style function syntax?
Where can I get an ansi-compatible lint?
Is void a keyword in c?
Are enumerations really portable?
Should I learn data structures in c or python?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What are the advantages of using macro in c language?
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
How many levels of indirection in pointers can you have in a single declaration?
Why isn't any of this standardized in c? Any real program has to do some of these things.