What is the difference between Char a[ ]=”string” and char
*a=”String”
Answer Posted / prasant nayak
differences are as follows
1.
Char a[]="string"; //invalid, coz--its not 'Char' but
its 'char' , i.e its syntaticaly incorrect
char *a="string";//it correct
2.
char a[]="string";
above 'a' is an array of characters , where we can change
the string, its not a constant.
i.e we can do a[3] = 'Z';
char *a = "string";
above 'a' is a string constant where we can't change the
string i.e we can't do a[3] = 'Z';
| Is This Answer Correct ? | 42 Yes | 6 No |
Post New Answer View All Answers
What is #include iomanip?
How do you invoke a base member function from a derived class in which you have not overridden that function?
What is constructor in C++?
Can a new be used in place of old mallocq? If yes, why?
What are libraries in c++?
Do you know what is overriding?
What are all predefined data types in c++?
What it is and how it might be called (2 methods).
What is the difference between prefix and postfix versions of operator++()?
If you don’t declare a return value, what type of return value is assumed?
What is a terminating character in c++?
What is the main function c++?
How the endl and setw manipulator works?
What is function overloading c++?
Explain mutable storage class specifier.