What is the difference between Char a[ ]=”string” and char
*a=”String”
Answer Posted / prasant nayak
differences are as follows
1.
Char a[]="string"; //invalid, coz--its not 'Char' but
its 'char' , i.e its syntaticaly incorrect
char *a="string";//it correct
2.
char a[]="string";
above 'a' is an array of characters , where we can change
the string, its not a constant.
i.e we can do a[3] = 'Z';
char *a = "string";
above 'a' is a string constant where we can't change the
string i.e we can't do a[3] = 'Z';
Is This Answer Correct ? | 42 Yes | 6 No |
Post New Answer View All Answers
What do you mean by enumerated data type?
What is the full form of india?
What is the basic concept of c++?
What are features of c++?
Which software is used to run c++ program?
Where and why do I have to put the "template" and "typename" keywords?
What is microsoft c++ redistributable?
What is struct c++?
what are the iterator and generic algorithms.
How the memory management in vectors are being done. What happens when the heap memory is full, and how do you handle it ?
What is a constructor in c++ with example?
Is c++ built on c?
write a porgram in c++ that reads an integer and print the biggest digit in the number
What are advantages of c++?
What is else syntax in c++?