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 are the various types of control structures in programming?
What is include directive in c?
Hi can anyone tell what is a start up code?
how can I convert a string to a number?
What are the different types of endless loops?
Why should I use standard library functions instead of writing my own?
hi send me sample aptitude papers of cts?
Write a simple code fragment that will check if a number is positive or negative.
Do you know what are the properties of union in c?
What is static and volatile in c?
what is the role you expect in software industry?
Why c is faster than c++?
What is sorting in c plus plus?
Write a program to use switch statement.
How to write a multi-statement macro?