Emulator
Emulator

Reputation: 186

Passing a constant value to a function

I am trying to pass a float32_t * const value to a function argument and I am getting exception errors. I have tried a lot of things but still receiving errors. My function is:

float32_t Distance(float32_t *const argDistance);

where float32_t is: typedef float float32_t;

I am trying to access this function like this:

float32_t* const tempTipDistance = 0;

but it tends to throw an exception:

SEH exception with code 0xc0000005 thrown in the test body.

Any suggestions on how to pass a value to this function?

Upvotes: 2

Views: 1097

Answers (1)

Anders Abel
Anders Abel

Reputation: 69260

You are sending in a pointer containing a 0 memory address, which is an invalid address to access. If you want to send in a pointer to the value 0.0 use:

float32_t value = 0.0;
float32_t* const tempTipDistance = &value;

Upvotes: 6

Related Questions