C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-07-2009, 06:58 AM   #1
Registered User
 
Join Date: Nov 2009
Posts: 1
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
but
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?

Code:
int main (){
 int k;
 printf("%d",k);
}
Thanks in advance.
cnickp is offline   Reply With Quote
Old 11-07-2009, 07:11 AM   #2
+++ OK NO CARRIER
 
quzah's Avatar
 
Join Date: Oct 2001
Posts: 10,260
It is defined that they are not required to be initialized.


Quzah.
__________________
Hundreds of thousands of dipshits can't be wrong.


Are you up for the suck?
quzah is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 02:57 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22