类和主函数外怎么没法为变量赋值?
才发现这个问题,类,主函数外没法为数据成员赋值,甚至内置类型也不行?
程序代码:
#include <iostream>
#include <stdio.h>
using namespace std ;
struct node{
int data ;
} ;
struct node tree ;
tree.data ;//没有可用成员
class A {
public:
int a;
} ;
A s1 ;
s1.a//此声明没有存储类或类型说明符
int c ;
c = 3 ;
int main( )
{
A s2 ;
s2.a = 3 ;
return 0;
}








