Functions in C language

Discussion in 'Programmer's Corner' started by VENKAT.R.PRASAD, Jan 29, 2004.

  1. VENKAT.R.PRASAD

    Thread Starter New Member

    Jan 27, 2004
    5
    0
    Can functions return a function ?
     
  2. Battousai

    Senior Member

    Nov 14, 2003
    141
    44
    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
     
  3. Abcd

    New Member

    Feb 15, 2004
    2
    0
    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.
     
  4. Abcd

    New Member

    Feb 15, 2004
    2
    0
    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:
     
  5. Battousai

    Senior Member

    Nov 14, 2003
    141
    44
    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++.
     
  6. Sputnik13

    New Member

    Feb 22, 2004
    2
    0
    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.
     
Loading...