先看代码
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct stu
{
int name;
char b[20];
};
int main()
{
void getgo(struct stu *& students);
struct stu * p=(struct stu *)malloc(sizeof(struct stu));
p->name=4444;
strcpy(p->b,"bbbbb");
getgo(p);
}
void getgo(struct stu* & students)
{
printf("%d,%s\n",students->name,students->b);
}
编译是通不过的
用G++编译
然后就通过了.奇葩吗?
去掉函数参数中的引用符号后
然后就通过过了,事情还没有完
如果去掉 结构体前的struct 关键字呢?会怎么样
就过不了了
用G++试一下.
然后就过了.
总结 这些好像都是G++的新特性, 传指针的引用, 还有就是面向对象的元素.