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
Which field is used in c++?
What is the full form of ios?
Write a note about the virtual member function?
What are activex and ole?
What is searching?
What are maps in c++?
You want to link a c++ program to c functions. How would you do it?
What is the best way to declare and define global variables?
Why main function is special in c++?
What is the difference between structures and unions?
Explain object slicing in c++?
How many types of modularization are there in c++?
What is the use of vtable?
What is the use of setfill in c++?
What are built-in functions? What is the syntax for the definition?