#include <iostream>
#include <stdlib.h>
using namespace std;
int * getint(char *p)
{
int value=20;
cout<<p<<endl;
return &value;
}
void somefn(char *p)
{
int b=40;
cout<<p<<endl;
}
int main(int argc, char *argv[])
{
int *p=getint("input a value:");
cout<<*p<<endl;
somefn("it is uncertain:");
cout<<*p<<endl;
system("PAUSE");
return 0;
}
//这里的输出是
input a value
20
it is uncertain
40 //按书上的说法这里不应该输出40 不解
#include <iostream>
#include <stdlib.h>
using namespace std;
int * getint(char *p)
{
int value=20;
cout<<p<<endl;
}
void somefn(char *p)
{
int b=40;
cout<<p<<endl;
}
int main(int argc, char *argv[])
{
int *p=getint("input a value:");
cout<<*p<<endl;
somefn("it is uncertain:");
cout<<*p<<endl;
system("PAUSE");
return 0;
}
//这里的输出是
input a value
4373020
it is uncertain
4373020