J
jdcrief
Using Visual C++2005 Expression Edition
Having trouble outputting the value referenced by the pointer and then
outputing the address of the pointer for the char. Any ideas would be
greatly appreciated!
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
int val_1 = 10;
long val_2 = 15;
float val_3= 2.86;
const char* val_4 = "apple juice";
//Right now, pval contains no particular val.
int* pval_1 = &val_1;
long* pval_2 = &val_2;
float* pval_3 = &val_3;
char pval_4 = val_4[6];
//Now, val in this c++ program contains the memory address of the
variable pval
cout<<"Address of the Int value "<<val_1<<" is - "<<pval_1<<endl;
cout<<"Address of the Long value "<<val_2<<" is - "<<pval_2<<endl;
cout<<"Address of the Float value "<<val_3<<" is- "<<pval_3<<endl;
cout<<"Address of the Char value '"<<val_4<<"' is - "<<pval_4<<endl;
return (0);
}
Having trouble outputting the value referenced by the pointer and then
outputing the address of the pointer for the char. Any ideas would be
greatly appreciated!
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
int val_1 = 10;
long val_2 = 15;
float val_3= 2.86;
const char* val_4 = "apple juice";
//Right now, pval contains no particular val.
int* pval_1 = &val_1;
long* pval_2 = &val_2;
float* pval_3 = &val_3;
char pval_4 = val_4[6];
//Now, val in this c++ program contains the memory address of the
variable pval
cout<<"Address of the Int value "<<val_1<<" is - "<<pval_1<<endl;
cout<<"Address of the Long value "<<val_2<<" is - "<<pval_2<<endl;
cout<<"Address of the Float value "<<val_3<<" is- "<<pval_3<<endl;
cout<<"Address of the Char value '"<<val_4<<"' is - "<<pval_4<<endl;
return (0);
}