What is the difference between Char a[ ]=”string” and char
*a=”String”
Answer Posted / anshul
I guess the main difference for which interviewer was looking for it that name of the array is constant pointer and character pointer is not. So, if
char a1[]="string";
char *a2="string";
a2=a1;//Compiles and works perfectly
a1=a2;//Error caught at compile time
This is a famous example and is available in many C books.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the advantages of using friend classes?
Evaluate the following expression as C++ would do :8 * 9 + 2 * 5 a) 82 b) 79 c) 370 d) list
How do you save a c++ program?
Describe linked list using C++ with an example.
Which bitwise operator is used to check whether a particular bit is on or off?
What does n mean in c++?
Which is not a valid keyword a) public b) protected c) guarded
How can we check whether the contents of two structure variables are same or not?
What is istream and ostream in c++?
What is virtual base class?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create
explain the reference variable in c++?
Explain the advantages of using friend classes.
Can circle be called an ellipse?
What is the use of setfill in c++?