This programming language may be used to instruct a computer to perform a task.
Execution method: | Compiled (machine code) |
---|---|
Garbage collected: | No |
Parameter passing methods: | By value |
Type safety: | Unsafe |
Type strength: | Weak |
Type compatibility: | Nominative |
Type expression: | Explicit |
Type checking: | Static |
Lang tag(s): | c |
See Also: |
If you know C, please write code for some of the tasks not implemented in C.
C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the UNIX operating system. C evolved from its predecessor, B.
C has since spread to many other platforms, and is now one of the most widely used programming languages. C has also greatly influenced many other popular languages, such as C++ and Objective-C, which were originally designed as enhancements to C. People are so familiar with its syntax that many other languages such as AWK, PHP, Java, JavaScript, D, and C# deliberately used its "look and feel". C is the most commonly used programming language for writing system software, though it is also widely used for writing applications. C is the lingua franca of the open source community.
Contents
Versions[edit]
- K&R C was the first widely-used form of C. It was originally documented in The C Programming Language, published in 1978. It is named for the authors, Brian Kernighan and Dennis Ritchie (also the language's creator). Code in this style is virtually nonexistent today.
- C89 (often called ANSI C) is the version of C standardized by ANSI in 1989. It is the most commonly used and supported version of the language.
- C90 (often called ISO C) is identical to C89, republished by ISO in 1990.
- C99 is a significant improvement, adopting many features of C++ and standardizing common compiler extensions. It was standardized by ISO in 1999, and by ANSI in 2000. It is primarily supported by commercial C compilers, but most of its features are available in Clang GCC. [1]
- C11 is the previous standard, published in December 2011. It is the default for GCC as of version 5.1.
- C18 is the current standard, published in June 2018. It is the default for GCC as of version 8.1.
- C2x is the upcoming standard, expected to be voted on in 2023 - it will then become C23. GCC 9, Clang 9 and Pelles C 11 have preliminary support for it.
Overview[edit]
Curly Braces[edit]
C uses curly braces as a separator for sections of code. All curly braces must be "balanced," i.e. every left curly brace must have a right curly brace after it. Nesting curly brace pairs inside curly braces is also acceptable as long as none of them are "lonely." Most advanced code editors will help you with curly braces by automatically typing the right brace as soon as you type the left one.
int main()
{
// your main program goes here
// if you forgot either of these curly braces you would get an error message when you try to compile!
}
The contents of a function, if statement, etc. must be enclosed in curly braces for the code to count as part of that section.
{
//this wouldn't actually compile as none of these variables were declared in this scope. More on that later.
if (K == 3)
{
X = Y; //this line will be skipped if K doesn't equal 3.
}
Y = Z; //this is not part of the if statement. It will execute even if K doesn't equal 3.
}
Semicolons[edit]
Any "executable" statement must end in a semicolon, such as an assignment or function call. If you get an error message from your compiler, it won't explicitly tell you "Expected semicolon at end of line X." Go to the line number it says the error is at, and look a few lines above that. You might have forgotten a semicolon there.
Scope[edit]
Unlike assembly which lets you jump anywhere or read any memory address, C imposes restrictions on labeled values. A variable defined inside a function can only be "seen" by that function, and not the ones outside it. Furthermore, you can re-use variable names inside a function and it refers to a different entity than the variable of the same name defined outside.
Functions[edit]
A function is made up of three parts: its return type, its name, and its arguments.
int main(void) //This is the function "main," which takes no arguments and returns a 32-bit signed integer value.
int sum(int a,int b) //This is the function "sum," which takes two integer arguments and returns an integer.
void PlaySound(char songName)
//This takes a character string as an argument and presumably sends a command to sound hardware.
//It returns no values. Functions that have a return value of "void" typically do some sort of
//procedure whose outcome does not need to be measured or remembered later.
Note that the variable names listed as arguments when declaring a function are known as formal parameters and only are there to define the function. Variables with those names need not be declared or defined in your actual function, nor do they refer to any variables in your program that happen to have the same name. Essentially, formal parameters act as placeholders for the actual function parameters that you'll be using.
int foo(int x){
return x;
} // "x" doesn't need to be a variable in your real program. If it is, that's not related in any way to the "x" here.
int main()
{
int y;
int z = 2;
y = foo(z); //note that x was never involved. That's because the "x" earlier was the formal parameter.
}
Assignment[edit]
C allows you to define a variable as equal to a value, in more ways than just simple numerals.
int a = 3; //declare the variable a of type int, define it equal to decimal 3.
int b = -1; //declare the variable b of type int, define it equal to -1 (0xFFFFFFFF in hex)
char letter = "A";
//declare the variable "letter" of type char, it equals capital A.
//C allows you to treat an ascii value as its numeric equivalent whenever you feel like it. Other languages do not.
char myString = "Hello"; //define the array "myString" containing the letters "Hello" followed by a null terminator.
int myArray[5] = {10,20,30,40,50};
//declare the array variable "myArray" containing integer values, with a maximum size of 5 elements.
//Then assign 10 to the beginning, 20 after it, 30 after that, and so on.
int c = sum(a,b);
//declare the integer variable "c".
//Define it to equal the output of the function sum using the previously defined variables "a" and "b" as arguments.
//When this line of code is executed, the computer will perform the function "sum(a,b)" and store the result in c.
//This is only valid if the return type of the function "sum" matches the type of the variable "c."
Declaring vs. Defining[edit]
This is a very unintuitive aspect of C that often confuses new users. Declaring a variable or function tells the compiler that a function may exist. Defining a variable or function assigns it a value or procedure, respectively. Compare the two examples below:
int a; // The variable "a" has been declared, but not defined.
a = 2; // Now the variable has been defined.
int a = 2; //The variable "a" has been both declared and defined.
- You cannot define a variable without declaring it first.
- Before a variable can be used, it must be defined.
Types[edit]
C has the following types built in by default, but you can create your own based on these using the typedef
directive. This is not an exhaustive list. Some of these names will have different meanings depending on the hardware you're programming for.
-
char
: an 8 bit value, typically used to represent ASCII characters. -
short
: a 16 bit value. -
int
: a 32 bit value. -
struct
: a collection of several other values, stored consecutively in memory. Each can be a different type. -
union
: a variable that can hold several different types of data, but only one at a time. -
float
: a single-precision (32-bit) floating-point decimal value.
You can also add a few modifiers in front of the variable type to be more specific:
-
unsigned
tells the compiler that this variable is always treated as positive. Computers use two's complement to represent negative numbers, meaning that if the leftmost bit of a number's binary equivalent is set, the value is considered negative. The resulting assembly code will use unsigned comparisons to check this variable against other variables. -
volatile
tells the compiler that this variable's value can changed by the hardware. This is commonly used for hardware registers such as those that track the mouse cursor's location, a scanline counter, etc. The value will always be read from its original memory location, ensuring that its value is always up-to-date.
Examples:
unsigned int x;
volatile int HorizontalScroll;
Functions are declared in a similar fashion to variables, except a function's "type" is the type of the value it returns.
int foo(int bar);
// The function foo was declared. It takes an integer as an argument and returns an integer.
// What it actually does is currently unknown but can be defined later.
Citation[edit]
Subcategories
This category has the following 3 subcategories, out of 3 total.
Pages in category "C"
The following 1,203 pages are in this category, out of 1,203 total.
A
- A* search algorithm
- A+B
- Abbreviations, automatic
- Abbreviations, easy
- Abbreviations, simple
- ABC problem
- ABC words
- Abelian sandpile model
- Abstract type
- Abundant odd numbers
- Abundant, deficient and perfect number classifications
- Accumulator factory
- Ackermann function
- Active Directory/Connect
- Active Directory/Search for a user
- Active object
- Addition chains
- Addition-chain exponentiation
- Additive primes
- Address of a variable
- Air mass
- AKS test for primes
- Align columns
- Aliquot sequence classifications
- Almost prime
- Alternade words
- Amb
- Amicable pairs
- Anagrams
- Anagrams/Deranged anagrams
- Angle difference between two bearings
- Angles (geometric), normalization and conversion
- Animate a pendulum
- Animation
- Anonymous recursion
- Anti-primes
- Append a record to the end of a text file
- Append numbers at same position in strings
- Apply a callback to an array
- Apply a digital filter (direct form II transposed)
- Approximate equality
- Arbitrary-precision integers (included)
- Archimedean spiral
- Arena storage pool
- Arithmetic evaluation
- Arithmetic numbers
- Arithmetic-geometric mean
- Arithmetic-geometric mean/Calculate Pi
- Arithmetic/Complex
- Arithmetic/Integer
- Arithmetic/Rational
- Array concatenation
- Array length
- Arrays
- ASCII art diagram converter
- Aspect oriented programming
- Assertions
- Associative array/Creation
- Associative array/Iteration
- Atomic updates
- Attractive numbers
- Average loop length
- Averages/Arithmetic mean
- Averages/Mean angle
- Averages/Mean time of day
- Averages/Median
- Averages/Mode
- Averages/Pythagorean means
- Averages/Root mean square
- Averages/Simple moving average
- AVL tree
B
- Babbage problem
- Bacon cipher
- Balanced brackets
- Balanced ternary
- Banker's algorithm
- Barnsley fern
- Base64 decode data
- Base64 encode data
- Bell numbers
- Benford's law
- Bernoulli numbers
- Best shuffle
- Bilinear interpolation
- Bin given limits
- Binary digits
- Binary search
- Binary strings
- Bioinformatics/base count
- Bioinformatics/Sequence mutation
- Biorhythms
- Birthday problem
- Bitcoin/address validation
- Bitcoin/public point to address
- Bitmap
- Bitmap/Bresenham's line algorithm
- Bitmap/Bézier curves/Cubic
- Bitmap/Bézier curves/Quadratic
- Bitmap/Flood fill
- Bitmap/Histogram
- Bitmap/Midpoint circle algorithm
- Bitmap/PPM conversion through a pipe
- Bitmap/Read a PPM file
- Bitmap/Read an image through a pipe
- Bitmap/Write a PPM file
- Bitwise IO
- Bitwise operations
- Boids
- Boolean values
- Box the compass
- Brace expansion
- Brazilian numbers
- Brownian tree
- Bulls and cows
- Bulls and cows/Player
- Burrows–Wheeler transform
C
- Caesar cipher
- Calculating the value of e
- Calendar
- Calendar - for "REAL" programmers
- Call a foreign-language function
- Call a function
- Call a function in a shared library
- Call an object method
- Canny edge detector
- Canonicalize CIDR
- Cantor set
- Card shuffles
- Carmichael 3 strong pseudoprimes
- Cartesian product of two or more lists
- Case-sensitivity of identifiers
- Casting out nines
- Catalan numbers
- Catalan numbers/Pascal's triangle
- Catamorphism
- Catmull–Clark subdivision surface
- Change e letters to i in words
- Changeable words
- Chaocipher
- Chaos game
- Character codes
- Chat server
- Chebyshev coefficients
- Check input device is a terminal
- Check output device is a terminal
- Check that file exists
- Checkpoint synchronization
- Chemical calculator
- Chernick's Carmichael numbers
- Cheryl's birthday
- Chinese remainder theorem
- Chinese zodiac
- Cholesky decomposition
- Chowla numbers
- Cipolla's algorithm
- Circles of given radius through two points
- Circular primes
- Cistercian numerals
- Classes
- Closest-pair problem
- Closures/Value capture
- Collections
- Color of a screen pixel
- Color quantization
- Colorful numbers
- Colour bars/Display
- Colour pinstripe/Display
- Combinations
- Combinations and permutations
- Combinations with repetitions
- Comma quibbling
- Command-line arguments
- Comments
- Common sorted list
- Compare a list of strings
- Compare length of two strings
- Compare sorting algorithms' performance
- Compile-time calculation
- Compiler/AST interpreter
- Compiler/code generator
- Compiler/lexical analyzer
- Compiler/syntax analyzer
- Compiler/Verifying syntax
- Compiler/virtual machine interpreter
- Compound data type
- Concurrent computing
- Conditional structures
- Conjugate transpose
- Constrained random points on a circle
- Continued fraction
- Continued fraction/Arithmetic/Construct from rational number
- Convert decimal number to rational
- Convert seconds to compound duration
- Convex hull
- Conway's Game of Life
- Coprime triplets
- Coprimes
- Copy a string
- Copy stdin to stdout
- Count how many vowels and consonants occur in a string
- Count in factors
- Count in octal
- Count occurrences of a substring
- Count the coins
- Cousin primes
- Cramer's rule
- CRC-32
- Create a file
- Create a file on magnetic tape
- Create a two-dimensional array at runtime
- Create an HTML table
- Create an object at a given address
- CSV data manipulation
- CSV to HTML translation
- Cuban primes
- Cumulative standard deviation
- Currency
- Currying
- CUSIP
- Cut a rectangle
- Cycle detection
D
- Damm algorithm
- Data Encryption Standard
- Date format
- Date manipulation
- Day of the week
- Day of the week of Christmas and New Year
- Days between dates
- Deal cards for FreeCell
- Death Star
- Decision tables
- Deconvolution/1D
- Deconvolution/2D+
- Deepcopy
- Delegates
- Delete a file
- Department numbers
- Detect division by zero
- Determinant and permanent
- Determine if a string has all the same characters
- Determine if a string has all unique characters
- Determine if a string is collapsible
- Determine if a string is numeric
- Determine if a string is squeezable
- Determine if only one instance is running
- Determine if two triangles overlap
- Dice game probabilities
- Digit fifth powers
- Digital root
- Digital root/Multiplicative digital root
- Dijkstra's algorithm
- Dinesman's multiple-dwelling problem
- Dining philosophers
- Diophantine linear system solving
- Discordian date
- Display a linear combination
- Distinct power numbers
- Distributed programming
- Diversity prediction theorem
- DNS query
- Documentation
- Doomsday rule
- Dot product
- Doubly-linked list/Definition
- Doubly-linked list/Element definition
- Doubly-linked list/Element insertion
- Doubly-linked list/Traversal
- Dragon curve
- Draw a clock
- Draw a cuboid
- Draw a pixel
- Draw a rotating cube
- Draw a sphere
- Draw pixel 2
- Dutch national flag problem
E
- Eban numbers
- Echo server
- Egyptian division
- Egyptian fractions
- EKG sequence convergence
- Element-wise operations
- Elementary cellular automaton
- Elementary cellular automaton/Random Number Generator
- Elliptic curve arithmetic
- Elliptic Curve Digital Signature Algorithm
- Emirp primes
- Empty directory
- Empty program
- Empty string
- Enforced immutability
- Entropy
- Entropy/Narcissist
- Enumerations
- Environment variables
- Equilibrium index
- Esthetic numbers
- Ethiopian multiplication
- Euler method
- Euler's constant 0.5772...
- Euler's identity
- Euler's sum of powers conjecture
- Evaluate binomial coefficients
- Even or odd
- Events
- Evolutionary algorithm
- Exactly three adjacent 3 in lists
- Exceptions
- Exceptions/Catch an exception thrown in a nested call
- Executable library
- Execute a Markov algorithm
- Execute a system command
- Execute Brain****
- Execute HQ9+
- Execute SNUSP
- Exponentiation operator
- Exponentiation order
- Extend your language
- Extensible prime generator
- Extra primes
- Extract file extension
- Extreme floating point values
F
- Factorial
- Factorions
- Factors of a Mersenne number
- Factors of an integer
- Fairshare between two and more
- Farey sequence
- Fast Fourier transform
- FASTA format
- Faulhaber's formula
- Faulhaber's triangle
- Feigenbaum constant calculation
- Fermat numbers
- Fibonacci n-step number sequences
- Fibonacci sequence
- Fibonacci word
- Fibonacci word/fractal
- File extension is in extensions list
- File input/output
- File modification time
- File size
- File size distribution
- Filter
- Find adjacent primes which differ by a square integer
- Find common directory path
- Find first and last set bit of a long integer
- Find if a point is within a triangle
- Find largest left truncatable prime in a given base
- Find limit of recursion
- Find palindromic numbers in both binary and ternary bases
- Find prime n such that reversed n is also prime
- Find prime numbers of the form n*n*n+2
- Find square difference
- Find squares n where n+1 is prime
- Find the intersection of a line with a plane
- Find the intersection of two lines
- Find the last Sunday of each month
- Find the missing permutation
- Find words which contains more than 3 e vowels
- Find words with alternating vowels and consonants
- Finite state machine
- First 9 prime Fibonacci number
- First class environments
- First perfect square in base n with n unique digits
- First power of 2 that has leading decimal digits of 12
- First-class functions
- Five weekends
- Fivenum
- FizzBuzz
- Flatten a list
- Flipping bits game
- Flow-control structures
- Floyd's triangle
- Floyd-Warshall algorithm
- Forest fire
- Fork
- Formal power series
- Formatted numeric output
- Forward difference
- Four bit adder
- Four is magic
- Four is the number of letters in the ...
- Four sides of square
- Fractal tree
- Fraction reduction
- Fractran
- Frobenius numbers
- FTP
- Function composition
- Function definition
- Function frequency
- Function prototype
- Fusc sequence
G
- Galton box animation
- Gamma function
- Gapful numbers
- Gauss-Jordan matrix inversion
- Gaussian elimination
- General FizzBuzz
- Generate Chess960 starting position
- Generate lower case ASCII alphabet
- Generate random chess position
- Generator/Exponential
- Generic swap
- Get system command output
- Getting the number of decimals
- Globally replace text in several files
- Go Fish
- Gray code
- Grayscale image
- Greatest common divisor
- Greatest element of a list
- Greatest subsequential sum
- Greyscale bars/Display
- Guess the number
- Guess the number/With feedback
- Guess the number/With feedback (player)
- GUI component interaction
- GUI enabling/disabling of controls
- GUI/Maximum window dimensions
H
- Hailstone sequence
- Halt and catch fire
- Hamming numbers
- Handle a signal
- Happy numbers
- Harshad or Niven series
- Hash from two arrays
- Haversine formula
- Hello world/Graphical
- Hello world/Line printer
- Hello world/Newbie
- Hello world/Newline omission
- Hello world/Standard error
- Hello world/Text
- Hello world/Web server
- Heronian triangles
- Hickerson series of almost integers
- Higher-order functions
- Hilbert curve
- Hofstadter Figure-Figure sequences
- Hofstadter Q sequence
- Hofstadter-Conway $10,000 sequence
- Holidays related to Easter
- Honeycombs
- Horizontal sundial calculations
- Horner's rule for polynomial evaluation
- Host introspection
- Hostname
- Hough transform
- HTTP
- HTTPS
- HTTPS/Authenticated
- Huffman coding
- Humble numbers
I
- I before E except after C
- IBAN
- Identity matrix
- Idiomatically determine all the lowercase and uppercase letters
- Image convolution
- Image noise
- Imaginary base numbers
- Implicit type conversion
- Include a file
- Increasing gaps between consecutive Niven numbers
- Increment a numerical string
- Infinity
- Inheritance/Multiple
- Inheritance/Single
- Input loop
- Input/Output for lines of text
- Input/Output for pairs of numbers
- Integer comparison
- Integer overflow
- Integer roots
- Integer sequence
- Intersecting number wheels
- Introspection
- Inverted index
- Inverted syntax
- IPC via named pipe
- ISBN13 check digit
- Isqrt (integer square root) of X
- Iterated digits squaring
J
K
- K-d tree
- K-means++ clustering
- Kahan summation
- Kaprekar numbers
- Kernighans large earthquake problem
- Keyboard input/Flush the keyboard buffer
- Keyboard input/Keypress check
- Keyboard input/Obtain a Y or N response
- Keyboard macros
- Knapsack problem/0-1
- Knapsack problem/Bounded
- Knapsack problem/Continuous
- Knapsack problem/Unbounded
- Knight's tour
- Knuth shuffle
- Knuth's algorithm S
- Koch curve
- Kolakoski sequence
- Kronecker product
- Kronecker product based fractals
L
- Lah numbers
- Langton's ant
- Largest difference between adjacent primes
- Largest five adjacent number
- Largest int from concatenated ints
- Largest number divisible by its digits
- Largest prime factor
- Largest proper divisor of n
- Last Friday of each month
- Last letter-first letter
- Last list item
- Law of cosines - triples
- Leap year
- Least common multiple
- Left factorials
- Length of an arc between two angles
- Leonardo numbers
- Letter frequency
- Levenshtein distance
- Levenshtein distance/Alignment
- Line circle intersection
- Linear congruential generator
- Linux CPU utilization
- List comprehensions
- List rooted trees
- Literals/Floating point
- Literals/Integer
- Literals/String
- Logical operations
- Logistic curve fitting in epidemiology
- Long multiplication
- Long primes
- Long stairs
- Long year
- Longest common prefix
- Longest common subsequence
- Longest common substring
- Longest common suffix
- Longest increasing subsequence
- Longest string challenge
- Longest substrings without repeating characters
- Look-and-say sequence
- Loop over multiple arrays simultaneously
- Loops/Break
- Loops/Continue
- Loops/Do-while
- Loops/Downward for
- Loops/For
- Loops/For with a specified step
- Loops/Foreach
- Loops/Increment loop index within loop body
- Loops/Infinite
- Loops/N plus one half
- Loops/Nested
- Loops/While
- Loops/With multiple ranges
- Loops/Wrong ranges
- LU decomposition
- Lucas-Lehmer test
- Lucky and even lucky numbers
- Ludic numbers
- Luhn test of credit card numbers
- LZW compression
M
- MAC Vendor Lookup
- Machine code
- Mad Libs
- Magic 8-ball
- Magic squares of doubly even order
- Magic squares of odd order
- Magic squares of singly even order
- Magnanimous numbers
- Main step of GOST 28147-89
- Make directory path
- Man or boy test
- Mandelbrot set
- Map range
- Matrix chain multiplication
- Matrix digital rain
- Matrix multiplication
- Matrix transposition
- Matrix with two diagonals
- Matrix-exponentiation operator
- Maximum triangle path sum
- Mayan numerals
- Maze generation
- Maze solving
- McNuggets problem
- MD4
- MD5
- MD5/Implementation
- Median filter
- Memory allocation
- Memory layout of a data structure
- Menu
- Mersenne primes
- Mertens function
- Metaprogramming
- Metered concurrency
- Metronome
- Mian-Chowla sequence
- Middle three digits
- Miller–Rabin primality test
- Mind boggling card trick
- Minesweeper game
- Minimum multiple of m where digital sum equals m
- Minimum number of cells after, before, above and below NxN squares
- Minimum numbers of three lists
- Minimum positive multiple in base 10 using only 0 and 1
- Minimum primes
- Modular arithmetic
- Modular exponentiation
- Modular inverse
- Modulinos
- Monads/Maybe monad
- Monte Carlo methods
- Montgomery reduction
- Monty Hall problem
- Morpion solitaire
- Morse code
- Mosaic matrix
- Motzkin numbers
- Mouse position
- Move-to-front algorithm
- Multi-dimensional array
- Multifactorial
- Multiline shebang
- Multiple distinct objects
- Multiple regression
- Multiplication tables
- Multiplicative order
- Multisplit
- Munchausen numbers
- Munching squares
- Musical scale
- Mutex
- Mutual recursion
- Möbius function
N
- N'th
- N-body problem
- N-queens problem
- N-smooth numbers
- Named parameters
- Naming conventions
- Narcissist
- Narcissistic decimal number
- Native shebang
- Natural sorting
- Nautical bell
- Negative base numbers
- Nested function
- Next highest int from digits
- Next special primes
- Nice primes
- Nim game
- Nimber arithmetic
- Non-continuous subsequences
- Non-decimal radices/Convert
- Non-decimal radices/Input
- Non-decimal radices/Output
- Nonoblock
- Nth root
- Null object
- Number names
- Number reversal game
- Numbers divisible by their individual digits, but not by the product of their digits.
- Numbers in base 10 that are palindromic in bases 2, 4, and 16
- Numbers in base-16 representation that cannot be written with decimal digits
- Numbers which binary and ternary digit sum are prime
- Numbers with equal rises and falls
- Numbers with prime digits whose sum is 13
- Numbers with same digit set in base 10 and base 16
- Numeric error propagation
- Numeric separator syntax
- Numerical integration
- Numerical integration/Adaptive Simpson's method
- Numerical integration/Gauss-Legendre Quadrature
O
- Odd word problem
- Old lady swallowed a fly
- Old Russian measure of length
- One of n lines in a file
- One-dimensional cellular automata
- OpenGL
- OpenGL pixel shader
- OpenGL/Utah Teapot
- Operator precedence
- Optional parameters
- Orbital elements
- Order by pair comparisons
- Order two numerical lists
- Ordered partitions
- Ordered words
- Own digits power sum
P
- P-value correction
- Padovan n-step number sequences
- Padovan sequence
- Palindrome dates
- Palindrome detection
- Palindromic gapful numbers
- Pancake numbers
- Pangram checker
- Paraffins
- Parallel brute force
- Parallel calculations
- Parameterized SQL statement
- Parametric polymorphism
- Parse an IP Address
- Parse command-line arguments
- Parsing/RPN calculator algorithm
- Parsing/RPN to infix conversion
- Parsing/Shunting-yard algorithm
- Partial function application
- Partition an integer x into n primes
- Partition function P
- Pascal matrix generation
- Pascal's triangle
- Pascal's triangle/Puzzle
- Password generator
- Pathological floating point problems
- Peaceful chess queen armies
- Peano curve
- Pell's equation
- Penney's game
- Pentagram
- Percentage difference between images
- Percolation/Bond percolation
- Percolation/Mean cluster density
- Percolation/Mean run density
- Percolation/Site percolation
- Perfect numbers
- Perfect shuffle
- Perfect totient numbers
- Perlin noise
- Permutation test
- Permutations
- Permutations by swapping
- Permutations with repetitions
- Permutations/Derangements
- Permutations/Rank of a permutation
- Permuted multiples
- Pernicious numbers
- Phrase reversals
- Pi
- Pick random element
- Pierpont primes
- Pig the dice game
- Pinstripe/Display
- Piprimes
- Plasma effect
- Playing cards
- Plot coordinate pairs
- Pointers and references
- Poker hand analyser
- Polymorphic copy
- Polymorphism
- Polynomial long division
- Polynomial regression
- Polyspiral
- Population count
- Power set
- Pragmatic directives
- Price fraction
- Primality by trial division
- Primality by Wilson's theorem
- Prime conspiracy
- Prime decomposition
- Prime triangle
- Primes - allocate descendants to their ancestors
- Primes whose first and last number is 3
- Primes whose sum of digits is 25
- Primorial numbers
- Print debugging statement
- Priority queue
- Probabilistic choice
- Problem of Apollonius
- Product of divisors
- Program name
- Program termination
- Proper divisors
- Pseudo-random numbers/Combined recursive generator MRG32k3a
- Pseudo-random numbers/Middle-square method
- Pseudo-random numbers/PCG32
- Pseudo-random numbers/Splitmix64
- Pseudo-random numbers/Xorshift star
- Pythagoras tree
- Pythagorean quadruples
- Pythagorean triples
R
- Ramer-Douglas-Peucker line simplification
- Ramsey's theorem
- Random Latin squares
- Random number generator (device)
- Random number generator (included)
- Random numbers
- Range consolidation
- Range expansion
- Range extraction
- Ranking methods
- Rate counter
- Ray-casting algorithm
- RCRPG
- Read a configuration file
- Read a file character by character/UTF8
- Read a file line by line
- Read a specific line from a file
- Read entire file
- Readline interface
- Real constants and functions
- Recaman's sequence
- Record sound
- Reduced row echelon form
- Regular expressions
- Remote agent/Agent interface
- Remote agent/Agent logic
- Remote agent/Simulation
- Remove duplicate elements
- Remove lines from a file
- Remove vowels from a string
- Rename a file
- Rendezvous
- Rep-string
- Repeat
- Repeat a string
- Resistor mesh
- Retrieve and search chat history
- Return multiple values
- Reverse a string
- Reverse words in a string
- RIPEMD-160
- User:Roboticist-Tav
- Rock-paper-scissors
- Rodrigues’ rotation formula
- Roman numerals/Decode
- Roman numerals/Encode
- Roots of a function
- Roots of a quadratic function
- Roots of unity
- Rosetta Code/Rank languages by popularity
- Rot-13
- RPG attributes generator
- RSA code
- Rule30
- Run as a daemon or service
- Run-length encoding
- Runge-Kutta method
S
- S-expressions
- Safe addition
- Safe primes and unsafe primes
- Sailors, coconuts and a monkey problem
- Same fringe
- Sattolo cycle
- Scope modifiers
- Scope/Function names and labels
- Search a list
- Search a list of records
- Secure temporary file
- SEDOLs
- Self numbers
- Self-describing numbers
- Semaphore
- Semiprime
- Semordnilap
- Send email
- Sequence of non-squares
- Sequence of primes by trial division
- Sequence of primorial primes
- Sequence: nth number with exactly n divisors
- Sequence: smallest number greater than previous term with exactly n divisors
- Sequence: smallest number with exactly n divisors
- Set
- Set consolidation
- Set of real numbers
- Set puzzle
- Seven-sided dice from five-sided dice
- Sexy primes
- SHA-1
- SHA-256
- SHA-256 Merkle tree
- Shell one-liner
- Shift list elements to left by 3
- Shoelace formula for polygonal area
- Short-circuit evaluation
- Shortest common supersequence
- Show ASCII table
- Show the (decimal) value of a number of 1s appended with a 3, then squared
- Show the epoch
- Sierpinski arrowhead curve
- Sierpinski carpet
- Sierpinski pentagon
- Sierpinski triangle
- Sierpinski triangle/Graphical
- Sieve of Eratosthenes
- Simple database
- Simple windowed application
- Simulate input/Keyboard
- Simulate input/Mouse
- Simulated annealing
- Sine wave
- Singleton
- Singly-linked list/Element definition
- Singly-linked list/Element insertion
- Singly-linked list/Element removal
- Singly-linked list/Traversal
- Sleep
- Smallest power of 6 whose decimal expansion contains n
- Smallest square that begins with n
- Smarandache prime-digital sequence
- Smith numbers
- Snake
- Snake and Ladder
- SOAP
- Sockets
- Sokoban
- Solve a Hidato puzzle
- Solve the no connection puzzle
- Sort a list of object identifiers
- Sort an array of composite structures
- Sort an integer array
- Sort disjoint sublist
- Sort numbers lexicographically
- Sort stability
- Sort the letters of string in alphabetical order
- Sort three variables
- Sort using a custom comparator
- Sorting algorithms/Bead sort
- Sorting algorithms/Bogosort
- Sorting algorithms/Bubble sort
- Sorting Algorithms/Circle Sort
- Sorting algorithms/Cocktail sort
- Sorting algorithms/Cocktail sort with shifting bounds
- Sorting algorithms/Comb sort
- Sorting algorithms/Counting sort
- Sorting algorithms/Cycle sort
- Sorting algorithms/Gnome sort
- Sorting algorithms/Heapsort
- Sorting algorithms/Insertion sort
- Sorting algorithms/Merge sort
- Sorting algorithms/Pancake sort
- Sorting algorithms/Patience sort
- Sorting algorithms/Permutation sort
- Sorting algorithms/Quicksort
- Sorting algorithms/Radix sort
- Sorting algorithms/Selection sort
- Sorting algorithms/Shell sort
- Sorting algorithms/Sleep sort
- Sorting algorithms/Stooge sort
- Sorting algorithms/Strand sort
- Sorting algorithms/Tree sort on a linked list
- Soundex
- Sparkline in unicode
- Special characters
- Special divisors
- Special factorials
- Special neighbor primes
- Special variables
- Speech synthesis
- Spelling of ordinal numbers
- Spinning rod animation/Text
- Spiral matrix
- Split a character string based on change of character
- Spoof game
- SQL-based authentication
- Square but not cube
- Square form factorization
- Square-free integers
- Stable marriage problem
- Stack
- Stack traces
- Stair-climbing puzzle
- Start from a main routine
- State name puzzle
- Statistics/Basic
- Statistics/Normal distribution
- Steady squares
- Stem-and-leaf plot
- Stern-Brocot sequence
- Stirling numbers of the first kind
- Stirling numbers of the second kind
- Straddling checkerboard
- Strange numbers
- Strange plus numbers
- Strange unique prime triplets
- Stream merge
- String append
- String case
- String comparison
- String concatenation
- String interpolation (included)
- String length
- String matching
- String prepend
- Strip a set of characters from a string
- Strip block comments
- Strip comments from a string
- Strip control codes and extended characters from a string
- Strip whitespace from a string/Top and tail
- Strong and weak primes
- Subleq
- Subset sum problem
- Substitution cipher
- Substring
- Substring/Top and tail
- Subtractive generator
- Successive prime differences
- Sudoku
- Sum and product of an array
- Sum and product puzzle
- Sum data type
- Sum digits of an integer
- Sum multiples of 3 and 5
- Sum of a series
- Sum of divisors
- Sum of elements below main diagonal of matrix
- Sum of first n cubes
- Sum of primes in odd positions is prime
- Sum of square and cube digits of an integer are primes
- Sum of squares
- Sum of the digits of n is substring of n
- Sum of two adjacent numbers are primes
- Sum to 100
- Summarize and say sequence
- Summarize primes
- Summation of primes
- Sunflower fractal
- Super-d numbers
- Superellipse
- Superpermutation minimisation
- Sutherland-Hodgman polygon clipping
- Symmetric difference
- Synchronous concurrency
- System time
T
- Table creation
- Table creation/Postal addresses
- Take notes on the command line
- Tarjan
- Tau function
- Tau number
- Taxicab numbers
- Teacup rim text
- Temperature conversion
- Terminal control/Clear the screen
- Terminal control/Coloured text
- Terminal control/Cursor movement
- Terminal control/Cursor positioning
- Terminal control/Dimensions
- Terminal control/Display an extended character
- Terminal control/Hiding the cursor
- Terminal control/Inverse video
- Terminal control/Positional read
- Terminal control/Preserve screen
- Terminal control/Ringing the terminal bell
- Terminal control/Unicode output
- Ternary logic
- Test a function
- Test integerness
- Text between
- Text processing/1
- Text processing/2
- Text processing/Max licenses in use
- Textonyms
- The ISAAC Cipher
- The Name Game
- The sieve of Sundaram
- The Twelve Days of Christmas
- Thiele's interpolation formula
- Three word location
- Thue-Morse
- Tic-tac-toe
- Time a function
- Tokenize a string
- Tokenize a string with escaping
- Tonelli-Shanks algorithm
- Top rank per group
- Topological sort
- Topological sort/Extracted top item
- Topswops
- Total circles area
- Totient function
- Towers of Hanoi
- Trabb Pardo–Knuth algorithm
- Tree traversal
- Trigonometric functions
- Triplet of three numbers
- Truncatable primes
- Truncate a file
- Truth table
- Twin primes
- Two bullet roulette
- Two identical strings
- Two sum
- Type detection
U
- Ulam numbers
- Ulam spiral (for primes)
- Unbias a random generator
- Undefined values
- Unicode strings
- Unicode variable names
- Unique characters
- Universal Turing machine
- Unix/ls
- Unprimeable numbers
- Untrusted environment
- UPC
- Update a configuration file
- URL decoding
- URL encoding
- Use another language to call a function
- Useless instructions
- User input/Graphical
- User input/Text
- UTF-8 encode and decode
V
- Validate International Securities Identification Number
- Vampire number
- Van der Corput sequence
- Van Eck sequence
- Variable declaration reset
- Variable size/Get
- Variable size/Set
- Variable-length quantity
- Variables
- Variadic function
- Vector
- Vector products
- Verhoeff algorithm
- Verify distribution uniformity/Chi-squared test
- Verify distribution uniformity/Naive
- Vibrating rectangles
- Vigenère cipher
- Vigenère cipher/Cryptanalysis
- Visualize a tree
- VList
- Vogel's approximation method
- Voronoi diagram
W
- Walk a directory/Non-recursively
- Walk a directory/Recursively
- Water collected between towers
- Web scraping
- Weird numbers
- Welch's t-test
- Wieferich primes
- WiktionaryDumps to words
- Window creation
- Window creation/X11
- Window management
- Wireworld
- Word frequency
- Word wheel
- Word wrap
- Wordle comparison
- Words containing "the" substring
- Words from neighbour ones
- World Cup group stage
- Write entire file
- Write float arrays to a text file
- Write language name in 3D ASCII
- Write to Windows event log