What's the difference if a struct parameter is indicated with the keyword "struct"?

I've seen structs described as parameters in functions like this:

1
2
3
4
5
6
7
8
9
struct someStruct {
   int code;
   string description;
};

void add_cat (struct someStruct c){
    cout << c.code;
    cout << c.description;
}


I know I can just avoid the word "struct" and indicate only the struct type ("someStruct"). Is there any difference? Does adding "struct" serve any purpose?

Thanks!
> What's the difference if a struct parameter is indicated with the keyword "struct"?

void add_cat ( struct someStruct ) ;

An elaborated-type-specifier may be used to refer to a previously declared class-name or enum-name even though the name has been hidden by a non-type declaration - IS


1
2
3
4
5
6
7
8
struct number { /* .... */ }; // in some header

int number = 22 ; // the class-name 'number' is hidden by the non-type declaration 'number'
                  // might have been brought in by the inclusion of another header

// void foo( number ) ; // *** error: number is not the name of a type
// void foo( ::number ) ; // *** error: number is not the name of a type
void foo( class number ) ; // fine: elaborated-type-specifier 
Thanks a lot to both!!
I swear I searched in StackOverflow but didn't find that specific thread :P
Topic archived. No new replies allowed.