#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    30
    Rep Power
    1

    Question Struct pointer pointer



    struct theStruct{
    int var;
    };

    struct theStruct * * var1;
    struct theSrtruct var2;

    var1 = var2;


    What does the last statement of the code mean??what does those 2 asterisk mean??
  2. #2
  3. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2004
    Location
    Mobile, Alabama
    Posts
    4,021
    Rep Power
    1285
    Actually that code won't compile because of a major syntax error.
    You can rewrite it as this.

    Code:
    struct theStruct{
    int var;
    };
    
    theStruct** var1;
    theStruct var2;
    
    int main() {
       var1 = var2;
    
       return(0);
    }
    That still has a syntax error because you can't assign var2 to var1.

    The two * mean that var1 is an array whose elements are themselves arrays of theStruct

IMN logo majestic logo threadwatch logo seochat tools logo