|
int
|
-2,147,483,648 to +1,147,483,647
|
|
float
|
4bytes,contain 1 digit/decimal, +-10^38, 7digitsprecision,f, illegalfloats: 6.2.2f,6.-3f,6.2
|
|
double
|
8bytes,+-10^308,14digitprecise
|
|
variable
|
upper/lowercase differ, reflects data stored, given to memory location
|
|
destructive read
|
Reference
|
|
destructive write
|
Write Over
|
|
types of c statements
|
declarations/arithmetic instructions/control instructions
|
|
Order of Operations (L->R)
|
!, * / %, + -, < > <= =>, == !=, &&, ||, =
|
|
Functions
|
AND (&&), OR (||), NOT (!)
|
|
QuadFormula
|
(-b+sqrt((b*b)-4ac))/(2a)
|
|
While Loop
|
executed 0 or more times. Does test, then body
|
|
Do-While Loop
|
executed 1+ times. Does body, then test
|
|
absolute value
|
abs(#)
|
printf("%6d",123);
printf("%03d",5);
printf("%7.2f",6.789);
i=5;
do
{
printf(i);
i++;
}
while(i>3);
k=7;
while(k<5)
{
printf("%d", k);
k++;
}
int dc;
scanf(“%lf”, dc);
switch(dc) //can only switch a non double/non float
{
case 0 : printf (“switch case statement 1”);
break;
case 1 : printf(“switch case statement 2”);
break;
default; //do default case, below this line
printf(“DEFAULT CASE”);
break;
}
If(logical expression)
{
//block of code
}
else
{
//statement if false
}
for(i=0;i<10;i++) //INIT, TEST, LOOP ALTER
{
printf("%d",i); //BODY
}
i=0; //INIT
while(i=0); //TEST
{
printf("%d",i); //BODY
i++; //LOOP ALTER
}
for(r=0;r<7;r++) //outer: 7 rows
{
for(s=0;s<r;s++) //controls spaces
{
printf(" ");
}
for(a=0;a<____*r;a++) //MATH
{
printf("*"); //controls stars
}
|
r
|
# stars
|
|
0
|
11
|
|
1
|
9
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.