structures?
Hello,
I am currently using a special C compiler for a micro processor and I have
come across a snag in the compiler results.
So I have very much so reduced my code to the minimum and gave it a try in
VC++. As I compiled it, I am getting an error. As much as I have used
structures, for the life of me I don't know why this doesn't work. Maybe its
because I am trying to pass a structure from function to function??????
I am doing a declaration of a structure, then passing the address of this
structure down to two functions deep and then comming back up one function
and expecting to read the structure's data using the "points to" operator
(->), which is something I never really tried before....or atleast I don't
think so! The data is different from what I set it to ???? But that's
besides the point right now, I would like to know why I get an error at
compile time!
Here is the code:
////////////////////////////////////////////////////////////////////////////////////
#include <iostream>
using namespace std;
struct ModIO_ID_TAG {
int ADR_ModPos_1; //Bottom left
int ADR_ModPos_2; //Top left
int ADR_ModPos_3; //Bottom right
int ADR_ModPos_4; //Top right
} ModIO_ID;
void IOSS(struct ModIO_ID_TAG *ModIO_ID );
void IO_Interface(struct ModIO_ID_TAG *ModIO_ID);
void main()
{
IO_Interface(&ModIO_ID);
}
void IO_Interface(struct ModIO_ID_TAG *ModIO_ID)
{
int Pos1,Pos2,Pos3,Pos4;
IOSS(&ModIO_ID);
Pos1 = ModIO_ID->ADR_ModPos_1;
Pos2 = ModIO_ID->ADR_ModPos_2;
Pos3 = ModIO_ID->ADR_ModPos_3;
Pos4 = ModIO_ID->ADR_ModPos_4;
}
void IOSS(struct ModIO_ID_TAG *ModIO_ID )
{
ModIO_ID->ADR_ModPos_4=100;//Data; //Store 1st byte from module #4
ModIO_ID->ADR_ModPos_3=101;//Data; //Store 2nd byte from module #3
ModIO_ID->ADR_ModPos_2=102; //Data; //Store 3rd byte from module #2
ModIO_ID->ADR_ModPos_1=103;//Data; //Store 4th byte from module #1
}
/////////////////////////////////////////////////////////////////////////////////////////
Anyways the error I am getting is:
c:\_DTS_PROGRAMMING\C_PROGRAMMING\vc++\_MY_APPS_LAB\TTT\ttt.cpp(24): error
C2664: 'IOSS' : cannot convert parameter 1 from 'ModIO_ID_TAG ** ' to
'ModIO_ID_TAG *'
Can anyone tell me why I am getting this error, I sincerely thankyou all in
advance
for your help!
--
Best regards
Robert