?
Solved

Pointers to Structures as Func Args

Posted on 1998-11-29
1
Medium Priority
?
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
trillo earned 200 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

719 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