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 time_t c++?
How would you use the functions sin(), pow(), sqrt()?
What are the benefits of c++?
Explain what is oop?
What are the advantage of using register variables?
Is c# written in c++?
How compile and run c++ program in turbo c++?
How should runtime errors be handled in c++?
Is c++ a pure oop language?
What is the c++ programming language used for?
What is the basic difference between C and C++?
Is c++ still in demand?
What is the full form of c++?
Explain function overloading and operator overloading.
How are pointers type-cast?