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 the difference between strcpy() and memcpy() function in c programming?
What will the preprocessor do for a program?
general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only
What was noalias and what ever happened to it?
Explain how can you tell whether two strings are the same?
Can we replace the struct function in tree syntax with a union?
How does placing some code lines between the comment symbol help in debugging the code?
Explain the priority queues?
What are the key features in c programming language?
What are c preprocessors?
What is sorting in c plus plus?
how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12
What are the types of functions in c?
What is the difference between null pointer and wild pointer?
What is pointer to pointer in c with example?