When I was a C programmer, I always wrote code indented as in your first example, just because I liked to have the opening and closing braces lined up. I carried on using that style when I moved over to Perl, but I changed to your second example some years ago, purely because I believed it to be more common.
Wikipedia has other examples of indent styles, should you wish to read more.