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


Please Help Members By Posting Answers For Below Questions

Is it better to bitshift a value than to multiply by 2?

660


What is the difference between printf and scanf in c?

752


What is preprocessor with example?

588


Explain modulus operator. What are the restrictions of a modulus operator?

600


Why is python slower than c?

606






How is a macro different from a function?

656


How can I open files mentioned on the command line, and parse option flags?

594


What is use of null pointer in c?

570


How do c compilers work?

611


Explain which function in c can be used to append a string to another string?

590


How can I dynamically allocate arrays?

594


cavium networks written test pattern ..

3596


Why flag is used in c?

651


explain what is a newline escape sequence?

690


What is a const pointer in c?

670