What is the difference between Char a[ ]=”string” and char
*a=”String”
Answer Posted / sushant mahajan
Ohk... dudes I think that 'C' in Char a[] is a typo. The only difference I can see is this:
char *a="string";
printf("%d", sizeof(a));
/*will print 2 or 4, whatever is the memory assigned to a pointer*/
char a[]="string";
printf("%d", sizeof(a));
/*will print 7 - 1 byte for each character+1 byte for the '\0' */
So basically its a memory thing :D
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
Define pure virtual function?
What are different types of loops in c++?
State the difference between delete and delete[].
Where the memory to the static variables is allocated?
How a modifier is similar to mutator?
What are the differences between java and c++?
Is it possible to use a new for the reallocation of pointers ?
What is singleton class in c++?
What is a c++ map?
What is scope resolution operator in c++ with example?
how to explain our contribution in the project?
Is c++ a difficult language?
Difference between overloaded functions and overridden functions
What is function declaration in c++ with example?
Which software is used for c++ programming?