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 methods can be overridden in java?
Explain the auto storage classes in c++.
What does the ios::ate argument do?
What is the basic concept of c++?
How do you clear a buffer in c++?
What is a multiset c++?
Is map thread safe c++?
By using c++ with an example describe linked list?
Differentiate between a pointer and a reference with respect to c++.
What is a c++ vector?
Explain public, protected, private in c++?
Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?
Describe public access specifiers?
How should runtime errors be handled in c++?
Is oops and c++ same?