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
Differentiate Source Codes from Object Codes
Does c have circular shift operators?
Do you know what are the properties of union in c?
How can you increase the allowable number of simultaneously open files?
What is pass by reference in functions?
What are the loops in c?
how to count no of words,characters,lines in a paragraph.
Calculate 1*2*3*____*n using recursive function??
Explain the difference between exit() and _exit() function?
What is formal argument?
What is a void pointer in c?
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
If the size of int data type is two bytes, what is the range of signed int data type?
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
What is the difference between union and structure in c?