Thread: Auto variable initialization

  1. #1
    Registered User
    Join Date
    Nov 2009

    Auto variable initialization

    I was experimenting in auto-variable initialization (eg int k; ) and I found out that :

    --On most windows machines ints are not auto-initialized to 0
    on some linux machines ints are auto-initialized to 0.

    Is there any standard (C89 / C99?) which specifies the behavior of the following program or it is undefined?

    int main (){
     int k;
    Thanks in advance.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    It is defined that they are not required to be initialized.

    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  2. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  3. Problem with a char variable set as a letter
    By 7smurfs in forum C++ Programming
    Replies: 6
    Last Post: 12-10-2004, 01:25 PM
  4. Need help
    By awkeller in forum C Programming
    Replies: 2
    Last Post: 12-09-2001, 03:02 PM
  5. Variable Allocation in a simple operating system
    By awkeller in forum C Programming
    Replies: 1
    Last Post: 12-08-2001, 02:26 PM