Updated specific locations to be searchable, take a look at Las Vegas as an example.

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
C++ - I found the answer to this problem, but I don't understand how it works. Could someone help me understand?
Post Body

I'm in my first programming class (C ) and we're on recursive functions. The project this week was to write a recursive function to count the amount of characters (including white spaces) in a C string and return that amount to the screen. I found the answer to the problem by Googling, but I don't really understand the solution. Here's the function definition:

int str_length(char s[]) {
    //base case
    if (s[0] == '\0')
        return 0;
    //recursive calls to str_length
    else {
        return 1   str_length(s   1);
    }

I understand the base case and generally how recursion works, but I specifically don't understand how the recursive call str_length(s 1); works. Could someone explain it to me? I'd really appreciate it!

Author
Account Strength
100%
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
5,886
Link Karma
2,891
Comment Karma
2,995
Profile updated: 8 hours ago
Posts updated: 4 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago