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 are dangling pointers in c?
Describe dynamic data structure in c programming language?
What is .obj file in c?
Why clrscr is used after variable declaration?
What are pointers in C? Give an example where to illustrate their significance.
What is far pointer in c?
What is a program flowchart and explain how does it help in writing a program?
Why do we use & in c?
How does selection sort work in c?
What is function what are the types of function?
Explain what are preprocessor directives?
What is the difference between %d and %i?
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
Write a program that accept anumber in words
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?