Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Aug 19th, 2018 57 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. Why we must initialize a variable before using it? [closed]
  2. int count = 0;
  3.  
  4. while(count < 500)
  5. {
  6.    doFunction();
  7.    count ++;
  8. }
  9.  
  10. ...
  11.  
  12.  
  13. void doFunction() {
  14.  
  15.    count = sizeof(someString);
  16.    print(count);
  17.  
  18. }
  19.    
  20. int i = 0;
  21. int j = foo();
  22.    
  23. struct Foo { int i; int j; }
  24.  
  25. struct Foo f = {0};
  26.    
  27. int i ;  // uninitialised variable
  28.  
  29. i = some_function() ;  // variable is "used" in left of assignment expression.
  30. some_other_function( i ) ; // value of variable is used
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top