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
Explain how overloading takes place in c++?
Please explain the reference variable in c++?
Is python written in c or c++?
What is an incomplete type in c++?
What are files in c++?
What is c++ course?
Do you know what are pure virtual functions?
What is pure virtual function?
What is the use of class in c++?
Explain differences between new() and delete()?
What is the word you will use when defining a function in base class to allow this function to be a polimorphic function?
How can you say that a template is better than a base class?
What are the basic data types used in c++?
What is istream c++?
What is an undefined reference/unresolved external symbol error and how do I fix it?