Hi,

I'm getting seg fault in this

#include <iostream>

int main()
{
	char *p;
	*p='w';
	std::cout<<p;
	return 0;
}

I'm sure it is due to the line

*p='w';

I interpret this line as

Value at address p = 'w'

. I would like to hear an explanation on why I can't do this.

Thanks for your time

>I would like to hear an explanation on why I can't do this.
Because you never told p where to point. Thus, it could point anywhere, and "anywhere" is very likely outside of your address space.

commented: Coz she helped me with my dumb question* +1