Back on topic i.e. relevant to the original poster
What you've done is found your first example of code that isn't written as intuitively as it could be.
To explain, the way 'if (A) B' works is:
If the result was true / nonzero / non-null, then execute B.
There are two ways of approaching this. Some people always try to make sure A has no side-effects and is (as you expected) merely a check. Other people expect that everyone understands the subtleties of 'if', and will happily set the condition (A) to an important command that must be executed, and then check its result using the surrounding 'if' construct.
The first approach does lead to more verbose code that takes a bit longer to write, but it also makes your kind of misunderstanding less likely. This is a trivial example and one you'll get used to quickly, but there are lots and lots of other ways programmers can confuse each other, many of them far harder to figure out
Hope that all makes sense
[EDIT] Added this footnote. Here's an example of how such people would write the above code:
bool succeeded = al_init();
fprintf(stderr, "failed to initialize allegro!\n");
(Note 'bool' is C++ - in C it won't work and you'll have to write 'int'.)