Log In
Learn C Programming
All Lessons
Free Lessons (0)
1.
Introduction to C Programming
Getting Started with C
Virtues and Challenges
When Should I Use C?
The Bottom Line
2.
Data Types in C
First Steps
Variables
Data Types and Sizes
Declarations
Constants
Statements and Scope
Quiz on Basic Types and Statements
3.
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
4.
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
5.
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
6.
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
7.
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
8.
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
9.
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
10.
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
11.
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
12.
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
13.
C Debugger
The GNU Project Debugger (GDB)
Breakpoint
Mistakes
Tricky Code
Quiz on Debugging
14.
Code Profiling
Profiling of Code Using gprof
Known Slugs
Using the Compiler Optimizer Flags
15.
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
16.
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
17.
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
Project
Using a Bootstrapped t-test
18.
Conclusion
Concluding Thoughts
19.
Miscellaneous
Some Useful C Libraries
20.
Appendix: Setting Up the Environment
Install Some Basic Tool
Test Your Environment
Claim your Certificate
Home
Courses
Learn C Programming
Defining the Size of an Array
Explore different methods for defining the size of an array.
We'll cover the following...
Defining the size by specifying the size before the array name
Defining the size using the n variable
Defining the size using the #define preprocessor directive
Defining the size by specifying the size before the array name