online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
fn main() { /* Declare Variables */ let initial:i32; let mut value:i32; let resultSave:i32; let mut result:i32; // set variable values initial =7; value =3; //invoke function - incrementCorrected result = incrementCorrected(initial, value); // Print text to the console println!( "Add {1} to {0} yields {2}" , initial , value , result ); // set variable values value = -2; resultSave = result; //invoke function - incrementRevised result = incrementRevised(resultSave, value); // Print text to the console println!( "Add {1} to {0} yields {2}" , resultSave , value , result ); } /* Please comment out this function to get a good compile Function only left here as mouth trap The difference between this function and the successive one is in the definition off the result Variable a) result: i32 b) mut result: i32 */ /* Stores result into an existing variable ( attempted ) */ fn incrementOriginal(result: i32, value: i32 )-> i32{ result = result + value; return result; } /* Stores result into an existing variable ( works ) */ fn incrementCorrected(mut result: i32, value: i32 )-> i32{ result = result + value; return result; } /* Stores result into a new variable ( works) */ fn incrementRevised(result: i32, value: i32 )-> i32{ let resultNew: i32; resultNew = result + value; return resultNew; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue