Dereference pointer to int Error message

I have two problems.
My first problem:
1
2
3
4
5
6
7
8
#include <iostream>
using namespace std;
int main(){
char *a;
cout<<"U can write every thing in here:";
cin>>*a;
cout<<hex<<(int) *a;
return 0;}


This code block is run.But i take system error.

Second problem:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
using namespace std;
int main(){
int *a,*c,b=10;
cout<<"U enter ur *a value:";
cin>>*a;
cout<<"*a value in memory location:"<<a<<"\n\n";
cout<<"b=10\n";
cout<<"b value in memory location:"<<&b<<endl;
*c=*a+b;
cout<<"*a+b value: "<<*c;
cout<<"*a+b value in memory location: "<<c;
return 0;}


Thanks for ur view.
You can't read things into pointers that don't point to anything
http://www.cplusplus.com/doc/tutorial/pointers/
ok thnx
Topic archived. No new replies allowed.