View Single Post
  #1 (permalink)  
Old May 24th, 2007, 01:51 AM
v_kewlani v_kewlani is offline
Registered User
 
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Declaration of variable without initialization

Why does the declaration "int i;" generates value of i as 0 in languages like Java and C# but displays garbage values in C and C++. Also, when we declare i outside main in C or declare it as static outside class it shows value 0. Why is it so?



Reply With Quote