Sign in to follow this  
Followers 0
asinghai

c++


difference b/w char*x and char x[]

In char*x, the variable x is a pointer of character type(a pointer is variable which points(represent) to some memory location) in char x[] the x is a array of character type (like string). :D

Share this post


Link to post
Share on other sites

difference b/w char*x and char x[]

In char * x is the pointer pointing to the intial memory location and size of the pointer is not fix. but in char x[] we have to initialize the array of fix size.

Share this post


Link to post
Share on other sites
The difference here is that char *x puts in the read-only parts of the memory and making x a pointer to that, making any writing operation on this memory illegal. While doing: char x[] puts in read-only memory and copies to newly allocated memory on the stack. _____________ SEO Swindon

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0