what is the difference between these initializations?
Char a[]=”string”;
Char *p=”literal”;
Does *p++ increment p, or what it points to?
Answer Posted / bee
logically, both are treated as array of characters(i.e.
string) but....
1) a is an array of characters(a string)
2) p is a pointer to an array of characters
the statement char *p = "literal" is equivalent to
char j[] = "literal"
char *p = j;
3) *p++ can be seen as *(p++)....
this is so because '++' has higher recedence over '*'
operator. so, it increments address by 1 unit and prints
the corresponding value value
Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What does double pointer mean in c?
Explain what are reserved words?
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555
Explain enumerated types.
What is the time and space complexities of merge sort and when is it preferred over quick sort?
What is the scope of static variables in c language?
hi send me sample aptitude papers of cts?
What are control structures? What are the different types?
Define recursion in c.
Can we assign string to char pointer?
What is the heap in c?
Define macros.
Write a program to identify if a given binary tree is balanced or not.
Is it possible to have a function as a parameter in another function?
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?