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 the use of endl in c++?
What is a responder chain?
What is the difference between an external iterator and an internal iterator? Describe an advantage of an external iterator?
What is setfill c++?
Why c++ is called oop?
Why is c++ so fast?
What are the benefits of oop in c++?
what are the iterator and generic algorithms.
What is the type of 'this' pointer? When does it get created?
How do you clear a set in c++?
What is iomanip c++?
Difference between overloaded functions and overridden functions
Do the names of parameters have to agree in the prototype, definition, and call to the function?
What is & in c++ function?
Does a derived class inherit or doesn't inherit?