Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Passing a enum as a function parameter | C

I need to track where the function is calling too, so I made an enum with a list of the drivers I wish to track.

enum FPGA_IO_Type{

   A429_RX = 0,

   A429_TX = 1,

   A717_RX = 2,

   A717_TX = 3

};

now I want to put it as a function parameter

static void _function(otherData, enum FPGA_IO_Type)

and each function call looks something like this

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

_function(data, A429RX);

However I get an error for "Parameter name omitted".

What am I doing wrong?

>Solution :

You are not giving it a name identifier, should be like:

static void _function(otherData, enum FPGA_IO_Type type)

likewise when you define a struct

struct Abc
{
   ...
}

you can put it as a parameter such as

void function(struct Abc abc)
{

}

Here enum FPGA_IO_Type and struct Abc are the types of the parameter and type and abc are the identifiers.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading