Fireship · @fireship
C in 100 Seconds
Uploaded November 10, 2021 · Length 2:25
Summary
c programming language basics in 100 seconds, including syntax, variables, memory management, and compilation.
- c programming language
- c syntax
- c variables
- memory management in c
- c compilation
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
C A statically typed procedural
- 0:02
programming language famous for making
- 0:04
the world go around it's the language
- 0:06
behind many tools we take for granted
- 0:08
like the windows Linux and Mac operating
- 0:10
system kernels databases like MySQL
- 0:13
interpreters for languages like python
- 0:15
tools like vim and git and countless
- 0:17
others it was created in 1972 by Dennis
- 0:20
Richie at Bell Labs where it would be
- 0:22
used to develop the Unix operating
- 0:24
system it would go on to become the
- 0:25
mother of all languages inspiring the
- 0:27
syntax of C++ CP Java JavaScript Pearl
- 0:31
and PHP just to name a few it compiles
- 0:34
directly to machine code and requires
- 0:35
minimal runtime support but is platform
- 0:38
dependent meaning the executable is
- 0:39
designed to run on a specific operating
- 0:42
system it's a highlevel language
- 0:43
designed for humans yet provides
- 0:45
low-level control over memory and
- 0:47
Hardware there's no garbage collector
- 0:49
instead your code needs to manage its
- 0:50
own memory when you create a variable
- 0:52
it's assigned an address in memory you
- 0:54
can store that address in another
- 0:56
variable called a pointer when the
- 0:57
variable is no longer needed you'll need
- 0:59
to free it to avoid memory leaks to get
- 1:01
started install a c compiler a popular
- 1:04
choice is the g c compiler or GCC create
- 1:07
a file ending in. C include any
- 1:09
libraries you plan to use then add a
- 1:11
main function to it this is where your
- 1:12
program will start executing there's no
- 1:14
function keyword and notice how it
- 1:16
returns an integer type a return value
- 1:18
of zero means success while a return
- 1:20
value of one means failure there are
- 1:22
only a few basic types in C create a
- 1:24
variable by starting with a type
- 1:26
followed by a name and value use print F
- 1:29
to print the value to the standard
- 1:30
output or put an Amper standand in front
- 1:32
of it to reference its address in memory
- 1:34
there's no string type but instead Char
- 1:36
which represents a one by character
- 1:38
stored as an integer a string can be
- 1:40
created with an array of characters each
- 1:42
letter will have its own memory address
- 1:44
and be terminated by a null character
- 1:46
another approach is to start with a
- 1:48
pointer by adding a star character in
- 1:50
front of the type then we can allocate
- 1:52
four bytes to it now assign a character
- 1:54
to each index ending with the null
- 1:56
character to create a string when you no
- 1:58
longer need that memory allocated to
- 1:59
your program use free to release it back


