- Everything you need to know to start with C.pdf (You do not have to learn everything in there yet, but make sure you read it entirely first)
- Dennis Ritchie
- "C" Programming Language: Brian Kernighan
- Why C Programming Is Awesome
- Learning to program in C part 1
- Learning to program in C part 2
- Understanding C program Compilation Process
- Betty Coding Style
- Linus Torvalds on C vs. C++
gccprintf (3)putsputchar
At the end of this project, you are expected to be able to explain to anyone, without the help of Google:
- General
- Why C programming is awesome
- Who invented C
- Who are Dennis Ritchie, Brian Kernighan, and Linus Torvalds
- What happens when you type
gcc main.c - What is an entry point
- What is
main - How to print text using
printf,puts, andputchar - How to get the size of a specific type using the unary operator
sizeof - How to compile using
gcc - What is the default program name when compiling with
gcc - What is the official C coding style and how to check your code with
betty-style - How to find the right header to include in your source code when using a standard library function
- How does the
mainfunction influence the return value of the program
-
C
- Allowed editors:
vi,vim,emacs - All your files will be compiled on Ubuntu 20.04 LTS using
gcc, using the options-Wall -Werror -Wextra -pedantic -std=gnu89 - All your files should end with a new line
- A
README.mdfile at the root of the repo, containing a description of the repository - A
README.mdfile, at the root of the folder of this project, containing a description of the project - There should be no errors and no warnings during compilation
- You are not allowed to use
system - Your code should use the Betty style. It will be checked using
betty-style.plandbetty-doc.pl
- Allowed editors:
-
Shell Scripts
- Allowed editors:
vi,vim,emacs - All your scripts will be tested on Ubuntu 20.04 LTS
- All your scripts should be exactly two lines long (
$ wc -l fileshould print 2) - All your files should end with a new line
- The first line of all your files should be exactly
#!/bin/bash
- Allowed editors:
-
Betty linter
To run the Betty linter just with command
betty <filename>:- Go to the [Betty repository](Link to Betty repo - Replace with actual link)
- Clone the repo to your local machine
cdinto the Betty directory- Install the linter with
sudo ./install.sh emacsorvia new file calledbetty, and copy the script below:
#!/bin/bash # Simply a wrapper script to keep you from having to use betty-style # and betty-doc separately on every item. # Originally by Tim Britton (@wintermanc3r), multiargument added by # Larry Madeo (@hillmonkey) BIN_PATH="/usr/local/bin" BETTY_STYLE="betty-style" BETTY_DOC="betty-doc" if [ "$#" = "0" ]; then echo "No arguments passed." exit 1 fi for argument in "$@" ; do echo -e "\n========== $argument ==========" ${BIN_PATH}/${BETTY_STYLE} "$argument" ${BIN_PATH}/${BETTY_DOC} "$argument" done-
Once saved, exit file and change permissions to apply to all users with
chmod a+x betty -
Move the
bettyfile into/bin/directory or somewhere else in your$PATHwithsudo mv betty /bin/ -
You can now type
betty <filename>to run the Betty linter!
- Everything you need to know to start with C.pdf (You do not have to learn everything in there yet, but make sure you read it entirely first and make sure you understand the slides: “comments”, “Data types | Integer types”, “Declaration”, “Characters”, “Arithmetic operators”, “Variables assignments”, “Comparisons”, “Logical operators”, “if, if…else”, “while loops”.)
- Keywords and identifiers
- Integers
- Arithmetic Operators in C
- If statements in C
- Relational operators
- Logical operators
- While loop in C
asciigccprintf (3)putsputchar
At the end of this project, you are expected to be able to explain to anyone, without the help of Google:
- General
- What are the arithmetic operators and how to use them
- What are the logical operators (sometimes called boolean operators) and how to use them
- What the relational operators are and how to use them
- What values are considered TRUE and FALSE in C
- What are the boolean operators and how to use them
- How to use the if, if ... else statements
- How to use comments
- How to declare variables of types
char,int,unsigned int - How to assign values to variables
- How to print the values of variables of type
char,int,unsigned intwithprintf - How to use the
whileloop - How to use variables with the
whileloop - How to print variables using
printf - What is the ASCII character set
- What are the purpose of the
gccflags-m32and-m64
-
C
- Allowed editors:
vi,vim,emacs - All your files will be compiled on Ubuntu 20.04 LTS using
gcc, using the options-Wall -Werror -Wextra -pedantic -std=gnu89 - All your files should end with a new line
- A
README.mdfile, at the root of the folder of this project - There should be no errors and no warnings during compilation
- You are not allowed to use
system - Your code should use the Betty style. It will be checked using
betty-style.plandbetty-doc.pl
- Allowed editors:
-
Shell Scripts
- Allowed editors:
vi,vim,emacs - All your scripts will be tested on Ubuntu 20.04 LTS
- All your scripts should be exactly two lines long (
$ wc -l fileshould print 2) - All your files should end with a new line
- The first line of all your files should be exactly
#!/bin/bash
- Allowed editors:
-
Betty linter
To run the Betty linter just with command
betty <filename>:- Go to the Betty repository
- Clone the repo to your local machine
cdinto the Betty directory- Install the linter with
sudo ./install.sh emacsorvia new file calledbetty, and copy the script below:
#!/bin/bash # Simply a wrapper script to keep you from having to use betty-style # and betty-doc separately on every item. # Originally by Tim Britton (@wintermanc3r), multiargument added by # Larry Madeo (@hillmonkey) BIN_PATH="/usr/local/bin" BETTY_STYLE="betty-style" BETTY_DOC="betty-doc" if [ "$#" = "0" ]; then echo "No arguments passed." exit 1 fi for argument in "$@" ; do echo -e "\n========== $argument ==========" ${BIN_PATH}/${BETTY_STYLE} "$argument" ${BIN_PATH}/${BETTY_DOC} "$argument" done
- Once saved, exit file and change permissions to apply to all users with
chmod a+x betty - Move the
bettyfile into/bin/directory or somewhere else in your$PATHwithsudo mv betty /bin/ - You can now type
betty <filename>to run the Betty linter!
It is your responsibility to request a review for your blog from a peer before the project’s deadline. If no peers have been reviewed, you should request a review from a TA or staff member.
It is your responsibility to request a review for your blog from a peer before the project’s deadline. If no peers have been reviewed, you should request a review from a TA or staff member.
Read or watch the following:
- Nested while loops
- C - Functions
- Learning to Program in C (Part 06) (stop at 14:00)
- What is a function prototype (read only the “Function prototype paragraph”)
- What is the purpose of a function prototype?
- C - Header Files (stop before the “Once-Only Headers” paragraph)
At the end of this project, you are expected to be able to explain to anyone, without the help of Google:
- What are nested loops and how to use them
- What is a function and how do you use functions
- What is the difference between a declaration and a definition of a function
- What is a function prototype
- Scope of variables
- What are the
gccflags:-Wall -Werror -pedantic -Wextra -std=gnu89 - What are header files and how to use them with
#include
- Allowed editors:
vi,vim,emacs - All your files will be compiled on Ubuntu 20.04 LTS using
gcc, using the options-Wall -Werror -Wextra -pedantic -std=gnu89 - All your files should end with a new line
- A
README.mdfile at the root of the project folder is mandatory - Your code should follow the Betty style. It will be checked using
betty-style.plandbetty-doc.pl - You are not allowed to use global variables
- No more than 5 functions per file
- You are not allowed to use the standard library. Any use of functions like
printf,puts, etc. is forbidden - You are allowed to use
_putchar - You don’t have to push
_putchar.c— we will use our file. If you push it, it won’t be taken into account - In the following examples, the
main.cfiles are shown as examples. You can use them to test your functions, but you don’t have to push them to your repo (if you do, we won’t take them into account). We will use our ownmain.cfiles at compilation. Ourmain.cfiles might be different from the one shown in the examples - The prototypes of all your functions and the prototype of the function
_putcharshould be included in your header file calledmain.h - Don’t forget to push your header file
- You do not have to understand the call by reference (address), stack, static variables, recursion, or arrays, yet.
