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

What is the difference between strcpy() and memcpy() function in c programming?

622


What will the preprocessor do for a program?

582


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

581


What was noalias and what ever happened to it?

590


Explain how can you tell whether two strings are the same?

580






Can we replace the struct function in tree syntax with a union?

771


How does placing some code lines between the comment symbol help in debugging the code?

538


Explain the priority queues?

617


What are the key features in c programming language?

605


What are c preprocessors?

670


What is sorting in c plus plus?

561


how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12

644


What are the types of functions in c?

567


What is the difference between null pointer and wild pointer?

630


What is pointer to pointer in c with example?

542