did not include header file

Discussion in 'C' started by answerme, Dec 19, 2007.

  1. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    main()
    {
      const int Men   = 10;
      int       *Women = &Men;
    
      *Women = 20;
    
      printf("There are %d men\n", Men);
      
    }
    I havent include #include header file but still prg is running how is it possible.
     
  2. Salem

    Salem New Member

    Joined:
    Nov 15, 2007
    Messages:
    133
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Please don't PM me for 1:1 support.
    You got lucky. The compiler's guess as to what the function prototype should be was close enough to its actual declaration to produce something which worked.

    Do you understand my sig yet?
     
  3. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    To be honest NO ,could elaborate more
     
  4. Salem

    Salem New Member

    Joined:
    Nov 15, 2007
    Messages:
    133
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Please don't PM me for 1:1 support.
    It's really saying that to be successful (long term) in your programs, you need to be good, not just lucky. C often lures you in with early success, despite making a catalogue of errors. But in larger programs, even the tiniest mistake will be punished harshly.

    Like dancing on broken glass, sometimes you get away with it and at some other time, you're lying in ER suffering from severe blood loss.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice