Functions in C language

Battousai

Joined Nov 14, 2003
141
I don't think so... are you talking about making a recursive call to a function that returns a value, or returning the name of a function which will be called by whoever called the returning function? ;) bleh this is confusing
 

Abcd

Joined Feb 15, 2004
2
Originally posted by VENKAT.R.PRASAD@Jan 29 2004, 01:30 AM
Can functions return a function ?
I don't think so function can return a function. As it may need to define the definition of one function into another which is not possible.
 

Abcd

Joined Feb 15, 2004
2
Originally posted by Abcd+Feb 16 2004, 12:07 AM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (Abcd @ Feb 16 2004, 12:07 AM)</td></tr><tr><td id='QUOTE'> <!--QuoteBegin-VENKAT.R.PRASAD@Jan 29 2004, 01:30 AM
Can functions return a function ?
I don't think so function can return a function. As it may need to define the definition of one function into another which is not possible. [/b][/quote]
I want to know if we can record something and then play in Dos.
I mean I want to make a project in C++ so that in the introduction the sentence "Welcome to " can be recorded by me and when the user runs the program, it should say Welcome to as it writes on the screen (by plotting a pixel).
Can we use html statements in doing this?

Waiting for an eager reply.......

Thanks :lol:
 

Battousai

Joined Nov 14, 2003
141
Originally posted by Abcd+Feb 15 2004, 09:07 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (Abcd @ Feb 15 2004, 09:07 PM)</td></tr><tr><td id='QUOTE'> <!--QuoteBegin-VENKAT.R.PRASAD@Jan 29 2004, 01:30 AM
Can functions return a function ?
I don't think so function can return a function. As it may need to define the definition of one function into another which is not possible. [/b][/quote]
This is actually possible in Lisp programming languages like Scheme.

Abcd- As long as you aren't using Windows libraries to playback sound, I believe all you need is a dos compiler like Borland Turbo C++.
 

Sputnik13

Joined Feb 22, 2004
2
You can return a function pointer, which depending on your need may suffice. You can always define a standard interface (function prototype) and return a function pointer to the specific implementation of the interface that you wish to be used, ie fn1() returns a function pointer to a function with the interface int fn( int, int ). Depending on the outcome of the operations within fn1() it returns a pointer to int fn2( int, int ) or int fn3( int, int ). However, I would say that if you're getting this complicated with functions, you should probably look in to using C++, as C really isn't the ideal language for things like this.
 
Top