Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

Default value of a variable

$
0
0

What is the initial value of a variable before it being assigned a value? For different variable types, I have different initial values:

  • (unsigned)int or (unsigned)long or bool(also arrays): 0
  • (unsigned)long long: 1
  • float: 0
  • double: 4.94066e-324
  • long double: 1.79581e+2383
  • (unsigned or signed)char`: (doesn't output anything)
  • double array: 3.23796e-319
  • string:(unpredictable(random) value)
  • ...

So why is default initial value like this for different var type?


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>