C++help

This is a discussion on C++help within the C++ Programming forums, part of the General Programming Boards category; Hi, it's me again with one question from my last program. Can I go through the string backwards by using ...

  1. #1
    Unregistered
    Guest

    Smile C++help

    Hi,
    it's me again with one question from my last program.
    Can I go through the string backwards by using if(ret != -1) ?
    Like this:

    int stringToPositiveInt(char s[ ]) {
    int checkString(string a);
    int ret = checkString(a);
    if(ret != -1) {
    return s[atoi(a)];
    }else{
    return -1;
    }
    }

    thank you,
    albina

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >return s[atoi(a)];
    Since your function returns an integer, this should be:
    return atoi(a);

    And can you explain your question?

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21