Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VIM:
- - CMD to start vim [ vim <filename> ]
- - vim has different modes
- * Insert Mode
- - To enter Insert Mode press I
- - To exit Insert Mode press Esc
- - The left of green block is where cursor is
- - To exit do Esc and :q
- - To save do Esc and :w
- * Put :qw to exit and save at same time
- C Formatting -
- - #include <headerfile.h>
- * This adds a premade library of functions to use
- * goes at top
- - int main() { return 1; }
- * This is the main function. It has all of the code you want ran first
- - Function(Argument1, Argument2);
- * Dont Forget That Fucking Semicolon
- How a C program Works -
- - Algorithm
- * Step by step instructions
- * Computers need very specific instructions
- - Functions
- * Block of code that can be repeated over and over
- * Function definition example
- void example(int number) { // Function definition
- number++;// Adds 1 to number varitable
- printf("%d\r\n", number); // Printf function Call
- return; // Return VOID datatype
- }
- * Calling example function
- - example(5);
- - the 5 is called argument
- - function adds 1 to 5 and prints to screen then exits function
- * Return
- - return is called when you want to exit function
- > can be placed anywhere in function
- - can return any data type (char, int, float, etc)
- * Datatypes
- - A datatype is a type of data like a number or a string
- - There are datatypes located at begining of functions
- > This datatype is for defining the type of data that gets returned
- - Char datatype
- > Also refered to as a string
- > Different Types of char
- * char string1[size]
- * char *string2;
- - Int datatype
- > Integer or whole number
- - Float datatype
- > Any real number aka numbers with decimals
- Basic Unix/Linux -
- * Linux is based of unix
- * Terminal/bash are more used in unix/linux than windows
- * C and unix are connected
- - C was originaly designed for unix
- * Directory = folder
- * Basic Commands
- - pwd returns the current working directory (CWD)
- - ls lists everything in your current directory
- - cd <directory> changes CWD to first argument
- - cat <File Path> reads files and prints to screen
- - Flags
- > Flags are arguments passed to programs with -
- > ex1) ls -a
- * lists everything including hidden folders
- > ex2) ls -l
- * lists the long version of ls
- - Directory
- > Absolute Path
- * From the very begining
- * Use / to define as Absolute path
- * Ex) cd /root
- > Relative Path
- * Path relative to cwd (current working directory)
- * Ex) cd ..
- > Root directory
- * The begining of all directory branches
- * /
- > Home directory
- * The directory where your users files are kept
- * First directory when opening terminal
- * ~/
- - Playing With files
- > touch <File Path>
- * Creates a file
- * touch main.c
- > mv <File Path> <To>
- * Moves files
- * mv main.c /tmp/main.c
- > rm <File Path>
- * Removes Files
- * rm main.c
- - Auto Completion
- > You can auto complete commands by typing enough characters and press tab
- - Echo
- > prints text
- > ex) echo "Hello World"
- > Echo to file
- * ex) echo "Hello World" > filename
- * Will overwrite everything in file
- > Echo to file appending
- * ex) echo "Hello World" >> filename
- * Instead of overwriting it appends or adds to file
- - Less
- > ex) less <File Path>
- > Shows 1 page of data from file at a time
- > Useful when theres alot of data in a file
- Basics Of C -
- * Format
- - Spacing
- > C is a space insensitive language
- > Used for clarity and ease of reading
- - Also called syntax
- * Variatables
- - Non case sensitive
- - Declaring Varitables
- > Ex) int x;
- - Initializing Varitables
- > Ex) x = 5;
- > stores the integer 5 in varitable x
- - Using Varitables
- > Ex) int y = x / 2;
- > This initializes the varitable y as x divided by 2
- - Expression
- > Anything that will evaluate to a single value
Add Comment
Please, Sign In to add comment