Solved

Pointers to Structures as Func Args

Posted on 1998-11-29
1
196 Views
Last Modified: 2010-04-15
I have a header file to a WIN32 DLL.Lib  with the equivalent of this:

typedef struct
{
      int m;
} X_Y;

typedef  X_Y *X_Y;

// prototypes

void WINAPI Funct1(X_Y *px);     // px - a pointer to a struct X_Y;
void WINAPI Funct2(X_Y **ppx);   // ppx - a pointer to a pointer to struct X_Y;

-----------------------------------------------------

Questions:
(1) How do I code my program to call these two functions.
(2) How do I then access members?

(details please I'm a newbie programmer)

Thanks
0
Comment
Question by:ketut
1 Comment
 
LVL 2

Accepted Solution

by:
trillo earned 50 total points
ID: 1254721
Declarations:

X_Y xy;        // Variable
X_Y *pxy;     //Pointer

To access the members.
int i;
i = xy.m;      //Member from a variable
i = pxy->m;  //Member from a pointer

Function calling syntax:
To call func 1:
Func1 (&xy);   //Passing the adress of a variable

to call func 2:
Func2 (&pxy)   //Passing the adress of the pointer (=double pointer);


Trillo
0

Featured Post

Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem with MFCApp 78 343
Compile VxWorks Toronado project under Visual Studio 11 179
Want to delete all my personal data 13 137
C language IDE – Compilers installation 14 66
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now