Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pub
hello-world
c_cpp_and_make
Commits
5171633e
Commit
5171633e
authored
Oct 21, 2020
by
Erik Strand
Browse files
More README updates
parent
8ae9bef9
Changes
3
Hide whitespace changes
Inline
Side-by-side
02_fundamentals/README.md
View file @
5171633e
# Fundamentals
These examples demonstrate C's basic types, how to use control structures like branches and loops,
and how to write functions.
and how to write functions. These things can get you pretty far. Some more advanced topics that
aren't (yet) covered here are pointers, and the difference between values and references. These
would be good next steps if you want to gain a deeper understanding of the language.
```
demo@linux:02_fundamentals$ make
...
...
03_inputs_and_outputs/README.md
View file @
5171633e
#
Basic In
put
#
Inputs and Out
put
s
These examples illustrate command line arguments, and reading a file.
So far we haven't interacted with our programs, except to read what they print to the terminal.
These examples illustrate how to make them accept command line arguments and read a file. Keep in
mind that this only applies on your computer -- I/O on a microcontroller will happen through its
peripherals, rather than the C standard library functions we use here.
```
demo@linux:03_inputs_and_outputs$ make
...
...
README.md
View file @
5171633e
...
...
@@ -4,6 +4,17 @@ Microcontrollers are great and all, but if you're new to programming it can help
about the software tools on their own before diving into the hardware as well. This repo has some
example programs in C and C++, along with Makefiles that help you build them.
There are a lot of great tutorials out there, from this class and elsewhere.
-
[
last year's slides
](
https://gitlab.cba.mit.edu/classes/863.19/site/blob/master/doc/programming_rec/programming_rec_slides.pdf
)
-
[
a few
](
https://www.tutorialspoint.com/cprogramming/index.htm
)
[
of many
](
https://www.cprogramming.com/tutorial/c-tutorial.html
)
[
online
](
https://beginnersbook.com/2014/01/c-tutorial-for-beginners-with-examples/
)
[
tutorials
](
https://www.learn-c.org/
)
This repo is meant to be more of a hands on reference. So clone it, build it, and play with it.
## The Basics
C is a programming language. It was created in the early 70s at Bell Labs by Dennis Ritchie and Ken
...
...
@@ -44,10 +55,17 @@ run gcc, you'll actually get clang. This is bad because not all the options are
sometimes it just won't work to switch between the two. So if you do install gcc with homebrew,
you'll want to run gcc-8 or gcc-9 (or whatever specific version you got).
On Windows... honestly I'm not sure. I haven't set up a development environment there in years.
On Windows... things are trickier. Most Windows applications assume you'll always use the graphical
user interface (GUI) and not the command line. You could install the
[
Windows Subsystem for
Linux
](
https://docs.microsoft.com/en-us/windows/wsl/install-win10
)
. This will work great for
compiling C to run on your own computer, but it might lead you into trouble when programming
microcontrollers (people often complain of USB errors in WSL). Before WSL,
[
MinGW
](
http://www.mingw.org/
)
was the go-to command line environment. Overall you'll probably have
a smoother experience if you bite the bullet and find/install Linux up front.
## Examples
-
[
hello world
](
./01_hello_world
)
-
[
fundamentals
](
./02_fundamentals
)
-
[
inputs and outputs
](
./03_inputs_and_outputs
)
-
[
inputs and outputs (on your computer)
](
./03_inputs_and_outputs
)
-
[
bit twiddling
](
./04_bit_twiddling
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment