Procedural compiled language telling computer what to do directly
Compilers - interpret human readable programming languages into machine cide
Machine Langue bits and bops
compiled language vs. assembly language
Brian Kernighan C Programming Language
Only whole number values (i.e. -1, 0 , 1 , 2 , ...)
//type name
int myInteger; // there exists an integer called myVariable
Allows Decimal point numbers (0.1f, 1.f, -0.2222f, ... )
//type name
int myFloat; // there exists an integer called myVariable
ASCII letters ('a', 'b', 'c', 'd'); these are secretly numbers but you can call them like this with the actual character.
//type name
char myChar;
myChar = 'a';
array of chars. IGNORE THIS WE DONT CARE. but in case you care
char str[] = "ignore";
char* str = {'i', 'g', 'n', 'o', 'r','e', '\0'} //'\0' is the null terminator so we know the string has ended.
boolean (bool)
true / false ( i.e. 0 or 1)
bool myBool;
myBool = true;
myBool = (1 < 20); //evaluates to true
myBool = (1 > 20); //evaluates to false
int myInteger = 1;
int myBigInteger = 20;
myBool = (myInteger < myBigInteger); // evaluates to true
myBool = (myInteger > myBigInteger); //evaluates to false
associativity meaning how the compiler will read it
- set something to be a value or another variable
- associativity left - to - right
int myInteger; //instantiate the variable myInteger
myInteger = 7; //set myInteger to be 7
int anotherInteger = 10; // same as above but in one line
myInteger = anotherInteger; // set myInteger to be the value of anotherInteger
int myInteger;
int result;
myInteger = 7;
result = myInteger + 5;
//result is now 12
int myInteger = 0 ;
result;
// these three lines are equivalent. They all add 1 to myInteger
myInteger = myInteger + 1;
//myInteger is now 1
myInteger += 1;
//myInteger is now 2
myInteger++; //special operator that always adds 1 does not work for any other number
//myInteger is now 3
just click the link
just click the link
while (condition)
{
//doStuff
}
while(1)
{
infinite loop
}
same as while loop but with simple way to repeat and end
//loop loopLength times
int loopLength = 8;
for (int i = 0; i < loopLength; i++)
{
}
if (condition)
{
//do stuff if true
}
if (condition)
{
//do stuff if true
}
else
{
//do stuff if false
}
if (condition)
{
}
else if (condition)
{
}
else
{
}
if (condition)
{
if(condition)
}
c - LEAF c++ - Daisy
leaf function
function_header(obj, variables)
Daisy function
obj.function_header(variables)