#include <iostream>
using namespace std;
#include "dos.h"
struct temp{
int a;
char c;
}test;
int getResult(struct temp *s){
return s->a+s->c;
}
int getResult(struct temp s){
return s.a+s.c;
}
char* getResult(char *p){
return p;
}
int* getResult(){
int a[]={1,3,5};
int sp=2;
int *p=&sp;
return a;
}
int main(){
//结构指针
struct temp *a;
a->a=1;
a->c=2;
int result=getResult(a);
cout<<result<<endl;
//指针
//test是结构预先定义好的变量,
test.a=2;
test.c=55;
int result2=getResult(test);
cout<<result2<<endl;
//返回字符串
char *p="helllo";
char *s=getResult(p);
cout<<s<<endl;
//返回数组
int *array=getResult();
printf("array%d/n",*array);
cout<<*array<<endl; //用cout不会输出
}