C

C is a general-purpose programming language that provides low-level access to memory and system hardware.

#include <stdio.h>
#include <cs50.h>

int main (void)
{
  printf("Hello, Grant!\n");
}

C CLI

C Interpreter

There is no interpreter for C.

C Files

hello_world.c

Printing Code

system("echo 'Hello world'")
puts("Hello world")
printf("Hello world")

Getting Input

input("What's your name? ")

C Modules

#include <stdio.h>
#include <stdlib.h>

C Basics

C Conditionals

if (false = false) {
  // code
}

C Loops

for (int i = 0; i < 256; i++) {
  // code
}
  • %d - Integer (10)
  • %f - Float (10.5)
  • %c - Single character ('A')
  • %s - String or array of characters ('Hello')
  • \n - Ensures each print starts on a new line.
printf(%d, num)
int counter = 0; int byte_length = 32;