Mona Jalal
Mona Jalal

Reputation: 38165

C Structs--error: parameter name omitted

I am receiving the following error for the following code:

kernel/proc.c: In function ‘getpinfo’:
kernel/proc.c:495: error: parameter name omitted

The code is as follows:

int 
getpinfo(struct pstat *)
{
}

Can you please tell me what I am missing about the struct or the code?

Upvotes: 0

Views: 4639

Answers (2)

Gangadhar
Gangadhar

Reputation: 10516

     int 
     getpinfo(struct pstat *)   
      {
      }

Did not given any parameter Name.

Function definition should contain List of parameters, with valid type and parameters names.where as in declarations parameter Names are optional

This should be

     int 
     getpinfo(struct pstat *some_name)
       {
       }

Upvotes: 4

Hunter McMillen
Hunter McMillen

Reputation: 61510

A parameter to a function requires both a type and a name, but struct pstat * is only a type.

You can give it any name you like:

int 
getpinfo(struct pstat * s)
{
}

Upvotes: 3

Related Questions