Thread: definitions inside FOR/IF blocks

  1. #1
    Banned
    Join Date
    Apr 2015
    Posts
    596

    definitions inside FOR/IF blocks

    Hi guys!
    why if I define for instance
    Code:
    int i=0;
    inside if statement then when I gets out from the if block the value of i isn't saved ?
    I mean like this:
    Code:
     if { int i=0}
    when I get out of "if" block then i isn't defined .. why?! thanks alot.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    It's a complete mystery isn't it.
    Well, not anymore.
    Bye.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Understanding redefinitions inside nesting blocks
    By Absurd in forum C Programming
    Replies: 6
    Last Post: 07-19-2015, 04:05 AM
  2. Replies: 23
    Last Post: 03-07-2011, 05:28 PM
  3. #definitions
    By errigour in forum C Programming
    Replies: 1
    Last Post: 11-11-2010, 08:24 AM
  4. Replies: 2
    Last Post: 04-13-2010, 03:14 PM
  5. definitions?
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 06-16-2002, 09:59 PM

Tags for this Thread