public struct shuzu
        {
            public float a;
            public float b;
            public float c;
            public float d;            public shuzu(float a, float b, float c, float d)
            {
                this.a = a;
                this.b = b;
                this.c = c;
                this.d = d;
            }
        }        shuzu[] aa = new shuzu[6];aa 在下面是不能用的。为什么???

解决方案 »

  1.   

     public struct shuzu 
            { 
                public float a; 
                public float b; 
                public float c; 
                public float d;             public shuzu(float a, float b, float c, float d) 
                { 
                    this.a = a; 
                     this.b = b; 
                    this.c = c; 
                    this.d = d; 

                    楼主没搞清楚变量的作用域
                     如果要给结构赋值应该这样写
                     shuzu newshuzu;
                   newshuzu.a=a;
                   newshuzu.b=b;
                   newshuzu.c=c;
                } 
            }         shuzu[] aa = new shuzu[6]; aa 在下面是不能用的。为什么???
      

  2.   

    shuzu[] aa = new shuzu[6]; 这一行你写在什么地方了?