What is the difference between Char a[ ]=”string” and char
*a=”String”

Answer Posted / vincy

the syntax for a character variable is wrong if we use a
pointer variable as given above that is char*a="string". so
i think the first one is right.we know that the pointer
variable points to the value in the particular address, then
it should not the "string" but "&string".

Is This Answer Correct ?    0 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How static variables and local variablesare similar and dissimilar?

835


What is the protected keyword used for?

873


What is a multiset c++?

797


What are vectors used for in c++?

824


What is the difference between the functions memmove() and memcpy()?

891


What do you mean by persistent and non persistent objects?

1107


Write a short code using c++ to print out all odd number from 1 to 100 using a for loop

814


what do you mean by volatile variable?

802


Explain about vectors in c ++?

812


What is size of string in c++?

764


Which command properly allocates memory a) char *a=new char[20]; b) char a=new char[20]; c) char a=new char(20.0);

847


What is a unnitialised pointer?

811


What language is a dll written in?

752


Explain terminate() function?

818


How do I get good at c++ programming?

864