AI Features
Log In
0% completed
All Lessons
Free Lessons (7)
Introduction to C Programming
Getting Started with C
Virtues and Challenges
When Should I Use C?
The Bottom Line
Data Types in C
First Steps
Variables
Data Types and Sizes
Declarations
Constants
Statements and Scope
Quiz on Basic Types and Statements
C Operators and C Expressions
Building Expressions Using Operators
Type Conversions
Defining Your Own Type Names
Other Convenient Operators
Exercise: Fahrenheit to Celsius
Solution: Fahrenheit to Celsius
Exercise: Compute the roots
Solution: Compute the Roots
Quiz on Operators and Expressions
Control Flow in C
The for Loop
Other Types of Loops in C
Conditionals
The break and continue Statements
A switch Statement
Exercise: FizzBuzz
Solution: FizzBuzz
Exercise: Newton's Method
Solution: Newton's Method
Exercise: Display a Triangle
Solution: Display a Triangle
Quiz on Control Flow
Functions in C
Rationale
Defining a Function
Input Arguments
Returning Values
Argument Checking
Variable Scope
Automatic vs. Static Variables
Inline Functions
Variadic Functions
Exercise: Compute the Fibonacci Number
Solution: Compute the Fibonacci Number
Exercise: Is the Number Prime
Solution: Is the Number Prime
Exercise: Get nth Prime Number
Solution: Get nth Prime Number
Quiz on Functions
Complex Data Types
Arrays
Writing to Arrays
Multidimensional Arrays
Variable Length Arrays
Command-Line Arguments
Structures
Flexible Array Members and Anonymous Structs
Exercise: Matrix Functions
Solution: Matrix Functions
Exercise: Input via Command Line
Solution: Input via Command Line
Quiz on Complex Data Types
Stack vs. Heap
The Stack
The Heap
Code Examples
Stack vs. Heap
Exercise: Fix the Memory Bug
Solution: Fix the Memory Bug
Quiz on Stack and Heap Memories
Pointers in C
Pointers
Pointers and Arrays
Passing Pointers to Struct
Passing Pointers to Functions
Dynamically Allocated Memory
Pointer to Functions
Exercise: Dynamic Matrix Function
Solution: Dynamic Matrix Functions
Exercise: Swap Two Numbers Using Pointers
Solution: Swap Two Numbers Using Pointers
Quiz on Pointers
C String
Strings
String Handling Using the C Standard Library
Arrays of Strings
Exercise: Uppercase the String
Solution: Uppercase the String
Exercise: Reverse the Words
Solution: Reverse the Words
Quiz on Strings
Input and Output Stream
I/O Streams
Input and Output with Files
Binary Files (Raw Bytes)
Random Access
Exercise: File Reading and Writing
Solution: File Reading and Writing
Quiz on Input and Output
Macros and the C Preprocessor
The C Preprocessor and #define Directives
Macros with Arguments
Conditional Compilation
Advanced Preprocessor Tricks
Exercise: Create Safe Macros
Solution: Create Safe Macros
Quiz on Macros and the C Preprocessor
Header Files, Compiling, and Linking
Splitting a Program into Multiple Files
The GNU make Utility and Makefiles
Dynamic Libraries and the Linker
Exercise: Fix the Linker Error
Solution: Fix the Linker Error
Quiz on Header Files, Compiling, and Linking
Project
Write a Shell in C
C Debugger
The GNU Project Debugger (GDB)
Breakpoint
Mistakes
Tricky Code
Quiz on Debugging
Code Profiling
Profiling of Code Using gprof
Known Slugs
Using the Compiler Optimizer Flags
System I/O and File Descriptors
From Standard I/O to System I/O
Understanding File Descriptors
Working Directly with System Calls
Redirecting and Duplicating Descriptors
Quiz on System I/O and File Descriptors
Interprocess Communication (IPC) in C
Introduction to Processes and IPC
Pipes and FIFOs
Shared Memory and Semaphores
Message Queues
Signals and Signal Handling
Comparing IPC Mechanisms
Quiz on IPC in C
Parallel Programming in C
Why Parallel Programming?
Kinds of Parallel Programming
Manual Threading with POSIX Threads
Synchronization with POSIX Threads
Compiler-assisted threading with OpenMP
Distributed message passing with MPI
Exercise: Parallel sum with POSIX threads
Solution: Parallel sum with POSIX threads
Quiz on Parallel Programming in C
Mini Project
Project: Using a Bootstrapped t-test
Conclusion
Concluding Thoughts
Miscellaneous
Some Useful C Libraries
Appendix: Setting Up the Environment
Install Some Basic Tool
Test Your Environment
Home
Courses
Learn C Programming
Exercise: Create Safe Macros
Write code to solve the problem.
We'll cover the following...
Question
...