Thread: Help - Function returning a sting

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    4

    Help - Function returning a sting

    Having a little problem..
    I need to return a string from a function..
    Here is my data...

    char returnsting(char result[])
    {
    result[]="STRNG";
    return(???);
    }

    I want to return my string...
    How can I do that?

  2. #2
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    Use strcpy to copy strings:
    Code:
    char returnsting(char *result)
    {
       if(result != NULL)
          strcpy(result, "STRNG");
    
       return result
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. returning pointers from a function
    By curlious in forum C++ Programming
    Replies: 2
    Last Post: 12-28-2003, 11:37 PM
  5. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM