online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
''' Demo code for module 1 part 1 "Data Types" 9/14/2021 -Dr. G When an OS runs a program it creates a "sandbox" in memory for it to use. The two types of memory it uses are a stack and a heap. We'll worry about the heap later. For now, know that when you create a variable you are reserving a space on the memory stack of a certain size and createing a way to reference that space by assigning it a variable name. It's very important to note the type of data placed there and not mix data types. ''' import sys #Concept 1 : Variables int, float, string, and boolean #Type is a function that takes "something" and tells you what it is #sys.getsizeof tells you how much memory it is using ''' print(type(4)) #print(sys.getsizeof(4)) print(type(4.0)) #print(sys.getsizeof(4.0)) print(type('a')) #print(sys.getsizeof('a')) print(type(True)) #print(sys.getsizeof(True)) print(type(False)) #print(type(true)) #predict the following then comment out and run ##print(type(3.8)) ##print(type('4')) ##print(type("4.3")) ''' #Type conversion ''' #observe the output print(type(4)) print(type(float(4))) print (float(4)) print(4+4) print(type(4+4)) ''' ''' #observe the output print(4+4.8) print(type(4+4.8)) print(int(4+4.8)) ''' ''' #observe the output part 3 print(4/4) print(type(4/4)) print(4//4) print(type(4//4)) #Predict the following the uncomment and see what happens #print(4/4.5) #print(4//4.0) ''' ''' #Concept 2 : Assignment and variable naming convention #if we instead want to store the value in a variable we do this: var = 4 print(var) print(type(var)) print(sys.getsizeof(var)) var = 'a' print(var) print(type(var)) print(sys.getsizeof(var)) ''' ''' # #These variable names, good or bad? x = 3 weight = 3.4 weight_of_subject_in_pounds = 3.4 xr132 = 45 WEIGHT = 34 #float = 4.5 print(x) print(weight) print(weight_of_subject_in_pounds) print(xr132) print(WEIGHT) ''' #Concept 3 : RValues and LValues ''' flag = True True = flag weight + 2 = 4 '''

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text



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