1/25
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
#include <stdio.h>
if printf scanf is used
#include <math.h>
if sin cos sqrt is used
#include <string.h>
if strlen strcpy strcmp strcat is used
for loop

while loop

do while loop

printf
printf("My age is %d and Pi is %.2f\n", age, pi);
Output: My age is 30 and Pi is 3.14
scanf
scanf("%d", &number);
if else statements

must declare and assign variables

#include <stdlib.h>
library to use system
#include <stdbool.h>
used if bool expressions
void main()
means the program does not send data back to the system
x==y
compare if they are equal
>= <=
greater than or equal
less than or equal
pre increment vs post increment

ternary operator
Y=(4 < 5) ? (42) : (9) Y=42
Y=(2==3) ? (a) : (b) Y=b
if statement
if (x <= 10)
y = x * x + 5;
switch
switch (variable) {
case 1: // Code runs if variable == 1
break;
case 2: // Code runs if variable == 2
break;
default:
// Code runs if nothing matches }
#define MAX 100
The compiler never sees "MAX"; it only sees the number 100.
const int max = 100;
creates a variable named max, assigns it the value 100, and flags it as "read-only."
array
int scores[] = {85, 90, 78, 92};
2d array

int Factorial (int n);
type of return value name of function type of argument
strcpy(string1,string2);
string 2 is copied onto string 1
int *p;
printf("%p\n", &myvar);