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
Solved

pointer to pointer as function parameter

Posted on 2012-03-25
3
329 Views
Last Modified: 2012-03-25
Hi Experts,

A function prototype is given as below.  I need to use this to get the Network list.
Result_t Query::queryNetworkList(Network **list, int& size) const

Open in new window

How can I iterate through this list and find all the Network items.
I am thinking something like below.. but not sure how to deal with the list.
Thanks,
Network *list;
int size = 0;
Query q;
q->queryNetworkList(&list, size);
for( int i = 0; i < size; i++ )
{
 ....

}

Open in new window

0
Comment
Question by:ambuli
  • 2
3 Comments
 
LVL 32

Expert Comment

by:phoffric
ID: 37763110
for( int i = 0; i < size; i++,  ++list)
{
    Network currentNetwork = *list;
 ....

}
0
 
LVL 32

Accepted Solution

by:
phoffric earned 500 total points
ID: 37763115
Query::queryNetworkList() should be returning the list pointer (that's why the method takes a **pointer - to allow it to modify and return the value into the caller's list pointer). It also returns the size of the Network List.

++list increments the list pointer by one element (not 1 byte) in the NetworkList array.
0
 

Author Closing Comment

by:ambuli
ID: 37763124
Thank you
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
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.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

789 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