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


Please Help Members By Posting Answers For Below Questions

What do you mean by enumerated data type?

762


What is the full form of india?

758


What is the basic concept of c++?

731


What are features of c++?

819


Which software is used to run c++ program?

708


Where and why do I have to put the "template" and "typename" keywords?

777


What is microsoft c++ redistributable?

767


What is struct c++?

733


what are the iterator and generic algorithms.

1666


How the memory management in vectors are being done. What happens when the heap memory is full, and how do you handle it ?

2045


What is a constructor in c++ with example?

797


Is c++ built on c?

752


write a porgram in c++ that reads an integer and print the biggest digit in the number

1990


What are advantages of c++?

766


What is else syntax in c++?

830