what is the difference between these initializations?
Char a[]=”string”;
Char *p=”literal”;
Does *p++ increment p, or what it points to?
Answer Posted / vignesh1988i
surely there is some difference.....
here 'a' is represented as array in which string gets stored
in consecutive locations......
p is a pointer variable where string is initilized... so in
p the base address of "literal " will get stored......
*p++ increments 'p' , but pertaining to some conditions.....
++ has more precedence than * , so first it will increment
the address and correspondingly it will show the value as *
precedes..... so after the increment the p points to 'i'...
thank u
Is This Answer Correct ? | 5 Yes | 5 No |
Post New Answer View All Answers
Is it better to bitshift a value than to multiply by 2?
What is the difference between printf and scanf in c?
What is preprocessor with example?
Explain modulus operator. What are the restrictions of a modulus operator?
Why is python slower than c?
How is a macro different from a function?
How can I open files mentioned on the command line, and parse option flags?
What is use of null pointer in c?
How do c compilers work?
Explain which function in c can be used to append a string to another string?
How can I dynamically allocate arrays?
cavium networks written test pattern ..
Why flag is used in c?
explain what is a newline escape sequence?
What is a const pointer in c?