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 scope rule of function in c?
Why pointers are used?
in linking some of os executables are linking name some of them
Tell us bitwise shift operators?
how many errors in c explain deply
How do you view the path?
What is variables in c?
When would you use a pointer to a function?
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers
How can I delete a file?
How are pointers declared in c?
What are the 4 types of functions?
What is the function of this pointer?
What does *p++ do?
What is string length in c?