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

Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?

862


C language questions for civil engineering

1341


What is difference between class and structure?

680


i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical

1960


What is the purpose of macro in C language?

748






Can an array be an Ivalue?

761


what will be maximum number of comparisons when number of elements are given?

1528


a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

720


i have a written test for microland please give me test pattern

2305


What is action and transformation in spark?

688


Why can’t we compare structures?

917


What is getche() function?

705


What are the functions to open and close file in c language?

818


What is ## preprocessor operator in c?

706


What is structure in c language?

717