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

When should a type cast not be used?

840


c language interview questions & answer

1708


Write a program to swap two numbers without using third variable in c?

870


Is c is a middle level language?

810


Explain the bubble sort algorithm.

862


What is a pointer in c?

994


What is ponter?

1024


Write a program to print factorial of given number without using recursion?

783


What are types of functions?

769


can we have joblib in a proc ?

1928


Explain what are global variables and explain how do you declare them?

847


application attempts to perform an operation?

1736


Can a variable be both const and volatile?

890


How can type-insensitive macros be created?

926


When should structures be passed by values or by references?

822