?
Solved

pointer to pointer as function parameter

Posted on 2012-03-25
3
Medium Priority
?
336 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
[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
  • 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 2000 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

762 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