Thread: Flags in C programming for beginners

  1. #1
    Registered User
    Join Date
    Nov 2016
    Posts
    33

    Flags in C programming for beginners

    Good day
    I'm studying c programming and came across with the flag concept
    indeed, this concept is still mysterious to me , i tried to google it and understand what it is about, but find almost nothing that can help me to understand (particularly for a beginner like myself)
    Could someone point me where i can tackle and master this concept?
    Many thanks in advance!!

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    A flag is simply the concept of setting a variable to indicate that something has happened.

    Code:
    flagVariable = 0;
    
    if (the thing has happened)
        flagVariable = 1;
    
    That variable can be tested to see if the thing has happened, and the program can react accordingly.

    Code:
    if (flagVariable is 1)
        // the thing has happened, act accordingly

  3. #3
    Registered User
    Join Date
    Nov 2016
    Posts
    33
    thank you very much do you know any book website with exercices where i can train myself ?

  4. #4
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Any decent book will come with practice problems and exercises.

    A search for "c practice problems" yields plenty of hits. There are some on the main site here, as well.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginners Programming Team
    By Mihai Feraru in forum Projects and Job Recruitment
    Replies: 6
    Last Post: 04-26-2015, 03:37 PM
  2. The Magic Gopher - New beginners programming challenge
    By rogster001 in forum Contests Board
    Replies: 20
    Last Post: 09-23-2012, 07:59 PM
  3. Replies: 4
    Last Post: 10-06-2009, 01:11 AM
  4. Beginners C Programming Challenge
    By UCnLA in forum C Programming
    Replies: 23
    Last Post: 04-01-2008, 07:46 PM
  5. Beginners C Programming Challenge
    By UCnLA in forum C Programming
    Replies: 2
    Last Post: 03-18-2008, 12:15 PM

Tags for this Thread