this is normal pointer that gives variable that var contains
Code:
#include <iostream>
#include <string>
using namespace std;
int main ()
{
int var = 0;
cout << var << endl;
int * pointer1 = &var;
cout << *pointer1 << endl;
int g;
cin >> g;
return 0;
}
it's all the same I have just put string instead of int
Code:
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string var = 0;
cout << var << endl;
string * pointer1 = &var;
cout << *pointer1 << endl;
int g;
cin >> g;
return 0;
}
1. I don't get compiler error
the program starts and ends very fast why???
what does program exactly do now??
or how to point to string???