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
Perform addition, multiplication, subtraction of 2-D array using Operator Overloading.
What is operators in c++?
Is sorted c++?
If you push the numbers (in order) 1, 3, and 5 onto a stack, which pops out first a) 1 b) 5 c) 3
Which ide is best for c++?
What is the array and initializing arrays in c++?
What is std :: endl?
Can a Structure contain a Pointer to itself?
Who made c++?
What is the default access level?
What it is and how it might be called (2 methods).
Which operations are permitted on pointers?
What will the line of code below print out and why?
Define pointers?
What is a class definition?