Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

pointer to pointer as function parameter

Posted on 2012-03-25
3
Medium Priority
?
339 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

604 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