![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Newbie
Join Date: Nov 2007
Location: Ireland
Posts: 21
Rep Power: 0
![]() |
Re: Function returning double pointer ?
Isn't an empty parenthesis only the same as void in C++, whereas in C it implies that the function can take a number of arguments?
|
|
|
|
|
|
#12 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5
![]() |
Re: Function returning double pointer ?
Quote:
I do happen to know that rpcgen is a pre-compiler for a sun-proprietary rpc (remote procedure call) interface specification. To answer your question, I would have to see some information about your interface specification, learn the rpc language and learn about workings of the (proprietary) rpgen compiler. Pay me the going rate -- which applies to clients who expect the impossible from nothing -- of US$1000 (with a minimal non-refundable deposit in advance equivalent to 40 hours) and I'll think about it.....maybe. You might have more luck by following simple advice: RTFM to learn about rpc and rpcgen for yourself. |
|
|
|
|
|
|
#13 |
|
Professional Programmer
|
Re: Function returning double pointer ?
Ok mate, don't get all angry there. I thought that a signature like
char ** methodname () , is not such an uncommon thing in c, and that a simple and precise answer exists. Don't feel like you HAVE to answer . It's a forum, if you want to answer then do it , otherwise don't . Ps : To me , the question seemed easy enough . Given a method signature like : char ** method(){} how do I return and use a " char * " variable.
__________________
Don't take life too seriously, it's not permanent ! |
|
|
|
|
|
#14 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5
![]() |
Re: Function returning double pointer ?
And you have just demonstrated the art of asking a simple question that is completely meaningless.
Your question is like "how do I work with a stick?". There are many answers, depending on what you want to do with it. You can hit someone with it (a thought that tempts me mightily at the moment). You can throw it. You can carve it into a statue. You can burn it. You can dig a hole with it. You can use it to stir soup. There is not a single answer to your question, unless you specify what the caller expects to do with the result returned by your function. You have not provided any such information, so there are many ways to "work with a method with a char ** return type". |
|
|
|
|
|
#15 |
|
Professional Programmer
|
Re: Function returning double pointer ?
Ok, the answer .. doesn't even matter anymore but if I can make grumpy undestand what I'm asking I'll have learned at least one thing
.So. From a function like : char ** ReturnString(){} I want to return a string. Then print the string on the screen. Let's say that I only have this function and main. That's all. Can I be anymore clear ?
__________________
Don't take life too seriously, it's not permanent ! |
|
|
|
|
|
#16 |
|
Professional Programmer
![]() Join Date: Sep 2005
Posts: 419
Rep Power: 4
![]() |
Re: Function returning double pointer ?
>Can I be anymore clear ?
Clear as mud. Why would you want to do such a thing? The "why" usually results in a clearer requirement and that quickly brings you to the "how". As it is, I could do anything to meet your requirement, such as: c Syntax (Toggle Plain Text)
__________________
Even if the voices aren't real, they have some pretty good ideas. |
|
|
|
|
|
#17 |
|
Professional Programmer
|
Re: Function returning double pointer ?
Ok, thanks for the answer.
__________________
Don't take life too seriously, it's not permanent ! |
|
|
|
|
|
#18 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5
![]() |
Re: Function returning double pointer ?
Narue's answer is one of many valid possibilities, but you still need to realise that it depends on how you call it. For example, a simple change of main() to;
int main(void)
{
puts( *(foo() + 2));
return 0;
} |
|
|
|
|
|
#19 | |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4
![]() |
Re: Function returning double pointer ?
Quote:
In C: int foo(); as a function declaration does mean there is no parameter specification, which then means you can call foo with different numbers of arguments of differing datatypes and not have the compiler complain. You'll see examples of this in the C99 standard especially with regard to function pointers. The standards are merely showing what is allowed. It's not necessarily a good thing to do. |
|
|
|
|
|
|
#20 | |
|
Programmer
Join Date: Nov 2007
Posts: 86
Rep Power: 2
![]() |
Re: Function returning double pointer ?
Quote:
c Syntax (Toggle Plain Text)
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Incompatible pointer type (double pointer in a function) | Gabriel Margarido | C | 16 | Nov 23rd, 2007 4:04 AM |
| Function pointer to a member function | Jimbo | C++ | 3 | May 12th, 2006 5:53 PM |
| Recommended Practice for returning data from function | Arla | C# | 1 | Aug 16th, 2005 1:21 PM |
| Returning a value from a variable to the main function | colt | C | 3 | Apr 28th, 2005 8:56 AM |
| Returning An Array From a Function | ViZioN | C++ | 5 | Feb 21st, 2005 7:45 PM |