Function to get a string and return same after processing in C

Posted by C0de_Hard on Stack Overflow See other posts from Stack Overflow or by C0de_Hard
Published on 2012-06-30T11:09:34Z Indexed on 2012/07/01 15:16 UTC
Read the original article Hit count: 104

Filed under:
|

I am working on a code which requires a function. This function gets a string as input and returns a string.

What I have planned so far is to get a str[], remove all $'s and spaces, and store this in another string which is returned later:

char *getstring(char str[])
{
    int i=0;
    char rtn[255];
    while (i<strlen(str))
    {
       if (str[i] != " " || str[i] != "$" )
             rtn[i] = str[i];
       else
             rtn[i] = '';
    } 
    return str;
}

I dont feel like this will work. Any ideas?? :-S

© Stack Overflow or respective owner

Related posts about c

    Related posts about string