Thread: functions defined as a string

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    3

    Question functions defined as a string

    I know that you can define a function as a "char *", but its been a couple of years, and I forget the specific syntax.

    I am calling a pair of C functions from a 4GL (an old IBM DB query language) program, passing four strings to the C function, and having the C function return a String.

    so far all I can think of is

    char *getGeo(char c_city[50])
    {
    }


    I've been using this anoying old language for a couple months, and it has robbed me of my C/C++ knowledge; it's a diabolic IBM scheme to rid the world of OO programming. Really, I swear it is.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Is the question how to do it in C, or how to do it in 4GL?

    In C:
    Code:
    char *myfunction( char array[50], char *stringy )
    {
       return stringy; //valid
       return array; //valid
    }
    You can pass a "string" as an array, or as a character pointer.
    You can return a character pointer.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Sayeh
    Guest
    Well, you can't actually declare a function as _anything_... you are declaring what the function will return onto the stack.


    char *foo(void);


    easy enough...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking problems in Visual Studio
    By h3ro in forum C++ Programming
    Replies: 5
    Last Post: 03-04-2008, 02:39 PM
  2. Inheritance Hierarchy for a Package class
    By twickre in forum C++ Programming
    Replies: 7
    Last Post: 12-08-2007, 04:13 PM
  3. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM
  4. Compile Error that i dont understand
    By bobthebullet990 in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2006, 09:19 AM
  5. string handling
    By lessrain in forum C Programming
    Replies: 3
    Last Post: 04-24-2002, 07:36 PM