Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8836839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:35:06+00:00 2026-06-14T09:35:06+00:00

While going through some allegro tutorials I found an odd call. int al_init(); The

  • 0

While going through some allegro tutorials I found an odd call.

int al_init();

The function al_init() initializes allegro so that the allegro functions can be used. What is with the int al_init(); line? If I change this line of the code to exclude int it works the same, but if I take out the line altogether it does not work. What is this line doing? The only thing I can imagine is that it creates an integer and assigns it the return value of the al_init() function, with that likely being -1 for failure and 0 for success etc. But if that is what this is doing, then how can you even check the return value?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:35:07+00:00Added an answer on June 14, 2026 at 9:35 am

    In C/C++ there are function declarations and function definitions:

    Declarations look like these:

    int a_function();
    void another_function();
    double yet_another_function();
    

    Explanation:

    • The identifier before the function name (e.g. int, void, double) describes the type of value returned by the function.
    • If you do not specify one, it defaults to int (which is why it works when you remove int from int al_init(), but not when you remove the declaration altogether)
    • void means it’s not supposed to return a value (even though technically it can, but that’s for rarer cases)

    Definitions look like these:

    int a_function() {
        std::cout << "hello world!";
        int x = 1;
        int y = 2;
        return (x + y);
    }
    

    Notice the difference:

    • Declarations end with ;
    • Definitions are followed by a block of code enclosed by braces: { and }, but no ;!
    • In some cases, you do not need to declare a function. If it’s at a point in the code where the definition has already been seen, the definition can substitute for the declaration (this leads us to the next point…)
    • The purpose of declaration is to tell the program that, for example, there is a function named a_function, it expects no arguments, and it returns a value of type int.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Going through some tutorials about sockets, I keep coming across code like that: while(true){
While going through some tutorials, I have encountered lines such as this: ((IDisposable)foo).Dispose(); Ignore
While going through the documentation, i read some where that ViewHolder is a static
I'm performing a while loop in C#, this is going through some records being
While going through SWig generated wrappers, I find that the PInvokes don't have any
While going through the syslog file, I found a message like shutdown via gdm
Yesterday while going through this question, I found a curious case of passing and
I am using Hibernate 3 version for my Application . While going through tutorials
while going through some of the mili source code I came across a struct
I have my loop going through vector's elements. While in this loop some of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.