a**1 发帖数: 213 | 1 只有两个包子了现在。
问题好像被问了很多次了,但没查到答案。谢谢。
这个思路对吗:
int* GetSomeIDs(aliasID*** p_aliasID_io)
怎么用GetNextAlias()? 这个问题说的太不清楚了。
题目是:
Correct the problems with GetSomeIDs(), and add some additional
functionality to it, as follows. A single new version of the function
should be provided.
The new version should:
a) Maintain the same "int *" return type which returns a pointer to fixed
sized array of ints.
b) IN ADDITION to its regular function return, provide to its calling
functions a usable array of poin | x***y 发帖数: 633 | 2 There is something unclear about the problem, but I think one possibility is:
Before calling the GetSomeIDs() function, the length of the array of aliasID
pointers is determined and a pointer is passed as a parameter to the
GetSomeIDs() function: ( we can cast p from void * to aliasID** inside the
function)
int* GetSomeIDs(void * p)
Inside this function, we can call int GetNumberOfAliases(void) to get # of
pointers in the array and dynamically allocate memory which will be assigned to each point
【在 a**1 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 只有两个包子了现在。 : 问题好像被问了很多次了,但没查到答案。谢谢。 : 这个思路对吗: : int* GetSomeIDs(aliasID*** p_aliasID_io) : 怎么用GetNextAlias()? 这个问题说的太不清楚了。 : 题目是: : Correct the problems with GetSomeIDs(), and add some additional : functionality to it, as follows. A single new version of the function : should be provided. : The new version should:
| a**1 发帖数: 213 | 3 atu1,您好:
您转给 xnxky,现金(伪币):10,收取手续费:0.1
同时附加了如下留言给 xnxky.
thanks
站务 | a**1 发帖数: 213 | 4 That will be too complicated compared to other questions.
What I am thinking is there is a collection of aliasIDs already there. Then
generate an array of pointers pointing to those aliasIDs. But there is still
something wrong here.
is:
aliasID
assigned to each pointer in the array(we get the address of these pointers
through void * parameter).
GetNextAlias will return the next available pointer or NULL.
【在 x***y 的大作中提到】![](/moin_static193/solenoid/img/up.png) : There is something unclear about the problem, but I think one possibility is: : Before calling the GetSomeIDs() function, the length of the array of aliasID : pointers is determined and a pointer is passed as a parameter to the : GetSomeIDs() function: ( we can cast p from void * to aliasID** inside the : function) : int* GetSomeIDs(void * p) : Inside this function, we can call int GetNumberOfAliases(void) to get # of : pointers in the array and dynamically allocate memory which will be assigned to each point
| x***y 发帖数: 633 | 5 Yes, it's also possible that in the function GetSomeIDS, we assign the array
of pointers some already existing aliasIDS structure, and when exiting from
this function, the call to GetNextAliss will get the next pointer to
aliasID in the array. We can use this method(calling GetSomeIDS and aliasID
iteratively to get all the IDS.) I'm not sure what else are expected....
Then
still
【在 a**1 的大作中提到】![](/moin_static193/solenoid/img/up.png) : That will be too complicated compared to other questions. : What I am thinking is there is a collection of aliasIDs already there. Then : generate an array of pointers pointing to those aliasIDs. But there is still : something wrong here. : : is: : aliasID : assigned to each pointer in the array(we get the address of these pointers : through void * parameter). : GetNextAlias will return the next available pointer or NULL.
| a**1 发帖数: 213 | |
|