C

general-purpose programming language

C is a general-purpose programming language. It was created in the 1970s by Dennis Ritchie and remains widely used and influential. By design, C gives the programmer relatively direct access to the … Wikipedia
Factsheet
Designed by Dennis Ritchie
Developer ANSI X3J11 (ANSI C); ISO/IEC JTC 1 (Joint Technical Committee 1) / SC 22 (Subcommittee 22) / WG 14 (Working Group 14) (ISO C)
Factsheet
Designed by Dennis Ritchie
Developer ANSI X3J11 (ANSI C); ISO/IEC JTC 1 (Joint Technical Committee 1) / SC 22 (Subcommittee 22) / WG 14 (Working Group 14) (ISO C)
🌐
Wikipedia
en.wikipedia.org › wiki › C_(programming_language)
C (programming language) - Wikipedia
November 10, 2001 - C is an imperative procedural language, supporting structured programming, lexical variable scope, and recursion, with a static type system. It was designed to be compiled to provide low-level access to memory and language constructs that map efficiently to machine instructions, all with minimal ...
🌐
W3Schools
w3schools.com › c › c_intro.php
Introduction to C
Create Variables Format Specifiers Change Values Multiple Variables Variable Names Real-Life Examples C Data Types
🌐
Reddit
reddit.com › r/cprogramming › why just no use c ?
r/cprogramming on Reddit: Why just no use c ?
January 22, 2025 -

Since I’ve started exploring C, I’ve realized that many programming languages rely on libraries built using C “bindings.” I know C is fast and simple, so why don’t people just stick to using and improving C instead of creating new languages every couple of years?

Top answer
1 of 40
59
C has some serious shortcomings that make it impractical or uncomfortable to use for many tasks. I wouldn't want to do, for example, web development in C. As for improving C, that happens but extremely slowly. C is rather unique in that it is a foundational language for just about every computer on the planet from the microcontroller in your electric toothbrush to the largest supercomputers. There are tens or hundreds of compilers in daily use. Every change to the language upsets someone and takes years to get through the standardization process. This is not necessarily a bad thing, C should evolve very conservatively.
2 of 40
31
Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp. --Greenspun's tenth rule C is used a great deal, and has been for a long time. But to get it up to the level of convenience and rapid-prototyping capability of (say) Python, one would pretty much have to implement something like Python! (CPython, the reference implementation, is, in fact, written in C!) Python (mostly) doesn't segfault. It (mostly) doesn't leak memory. You can load new functions into the program while it's running. It's easy to accidentally segfault or leak memory or generally mess up a pointer and read or write memory where you didn't want to. That mostly doesn't happen in Python. Many things that have to be design patterns in C are built into the language. It has dynamic typing, iterators, hash tables, automatic array resizing, a garbage collecter, a large standard library. The stack trace almost always points you to exactly your problem, but in C, you might accidentally overwrite the information you needed to debug it! Compared to Python, C feels tedious. Of course, there are costs to all of that. Python seem slow and bloated in comparison. In practice, CPython projects get most of the best of both worlds, because the fast library code gets written in C, and the slow Python code just glues those libraries together. Still bloated though.
🌐
HowStuffWorks
computer.howstuffworks.com › tech › computer software › programming
The Basics of C Programming | HowStuffWorks
March 8, 2023 - The C programming language is a popular and widely used programming language for creating computer programs.
🌐
GeeksforGeeks
geeksforgeeks.org › c language › c-programming-language
C Programming Tutorial - GeeksforGeeks
C is a general-purpose mid-level programming language developed by Dennis M. Ritchie at Bell Laboratories in 1972. It was initially used for the development of UNIX operating system, but it later became popular for a wide range of applications.
Published   October 13, 2025
🌐
Nokia
nokia.com › bell-labs › about › dennis-m-ritchie › chist.html
The Development of the C Language
C came into being in the years 1969-1973, in parallel with the early development of the Unix operating system; the most creative period occurred during 1972. Another spate of changes peaked between 1977 and 1979, when portability of the Unix system was being demonstrated.
🌐
Cprogramming.com
cprogramming.com
Learn C and C++ Programming - Cprogramming.com
How to begin Get the book · C tutorial C++ tutorial Game programming Graphics programming Algorithms More tutorials
Find elsewhere
🌐
Reddit
reddit.com › r/explainlikeimfive › eli5:what is the difference between c, c+, c++ and c#?
r/explainlikeimfive on Reddit: ELI5:What is the difference between C, C+, C++ and C#?
May 5, 2012 - C# is a C like language made by MS to try and suit their own needs and make writing applications for Windows and other MS products more easy.
🌐
Wikipedia
en.wikipedia.org › wiki › C++
C++ - Wikipedia
3 weeks ago - C++ is a high-level, general-purpose programming language created by Danish computer scientist Bjarne Stroustrup. First released in 1985 as an extension of the C programming language, adding object-oriented (OOP) features, it has since expanded ...
🌐
GNU
gnu.org › software › gnu-c-manual › gnu-c-manual.html
The GNU C Reference Manual
This is a reference manual for the C programming language as implemented by the GNU Compiler Collection (GCC).
🌐
Reddit
reddit.com › r/c_programming › could someone explain the use of the asterisk * in c and how it is used?
r/C_Programming on Reddit: Could someone explain the use of the asterisk * in C and how it is used?
April 26, 2022 -

I am currently working on an assignment in C where we are required to make a stack by simply using pointers.

I know the line: int *ptr = &val; declares ptr to be a "pointer to"(which is my interpretation of what asterisk * means in C) the "address of" the integer variable val.

When I want to create a double pointer, or a pointer to a pointer, I do so like:

int **ptr_ptr = &ptr; By setting ptr_ptr to a "pointer to" the address of pointer ptr.

When we use the asterisk anywhere other than in a declaration, it is usually referred to as dereferencing that pointer (I think), and grabbing the value that the pointer actually points to. This goes against my intuition that an asterisk means "pointer to".

Could anybody explain the proper meaning of the asterisk in C? Is it just that it means different things depending on how it is used (i.e. in a declaration versus anywhere else)?

Thanks!

Top answer
1 of 14
51

In C, arguments are passed by values. For example if you have an integer varaible in main

int main( void )
{
    int x = 10;
    //...

and the following function

void f( int x )
{
    x = 20;
    printf( "x = %d\n", x );
} 

then, if you call the function in main like this

f( x );

then the parameter gets the value of variable x in main. However the parameter itself occupies a different extent in memory than the argument. So any changes of the parameter in the function do not influence to the original variable in main because these changes occur in a different memory extent.

So how to change the varible in main in the function?

You need to pass a reference to the variable using pointers.

In this case the function declaration will look like

void f( int *px );

and the function definition will be

void f( int *px )
{
    *px = 20;
    printf( "*px = %d\n", *px );
} 

In this case, the memory extent occupied by the original variable x is changed because, within the function, we get access to this extent using the pointer

    *px = 20;

Naturally the function must be called in main like this

f( &x );

Take into account that the parameter itself that is the pointer px is a local variable of the function. That is, the function creates this variable and initializes it with the address of variable x.

Now let's assume that in main you declared a pointer for example the following way

int main( void )
{
   int *px = malloc( sizeof( int ) );
   //..

And the function is defined like

void f( int *px )
{
    px = malloc( sizeof( int ) );

    printf( "px = %p\n", px );
}

As parameter px is a local variable, assigning to it any value does not influence the original pointer. The function changes a different extent of memory than the extent occupied by the original pointer px in main.

How to change the original pointer in the function? Just pass it by reference!

For example

f( &px );
//...

void f( int **px )
{
    *px = malloc( sizeof( int ) );

    printf( "*px = %p\n", *px );
}

In this case, the value stored in the original pointer will be changed within the function because the function is using dereferencing, accessing the same memory extent where the original pointer was defined.

2 of 14
20

Q: what is this (**)?

A: Yes, it's exactly that. A pointer to a pointer.

Q: what use does it have?

A: It has a number of uses. Particularly in representing 2 dimensional data (images, etc). In the case of your example char** argv can be thought of as an array of an array of chars. In this case each char* points to the beginning of a string. You could actually declare this data yourself explicitly like so.

char* myStrings[] = {
    "Hello",
    "World"
};

char** argv = myStrings;

// argv[0] -> "Hello"
// argv[1] -> "World"

When you access a pointer like an array the number that you index it with and the size of the element itself are used to offset to the address of the next element in the array. You could also access all of your numbers like so, and in fact this is basically what C is doing. Keep in mind, the compiler knows how many bytes a type like int uses at compile time. So it knows how big each step should be to the next element.

*(numbers + 0) = 1, address 0x0061FF1C
*(numbers + 1) = 3, address 0x0061FF20
*(numbers + 2) = 4, address 0x0061FF24
*(numbers + 3) = 5, address 0x0061FF28

The * operator is called the dereference operator. It is used to retrieve the value from memory that is pointed to by a pointer. numbers is literally just a pointer to the first element in your array.

In the case of my example myStrings could look something like this assuming that a pointer/address is 4 bytes, meaning we are on a 32 bit machine.

myStrings = 0x0061FF14

// these are just 4 byte addresses
(myStrings + 0) -> 0x0061FF14 // 0 bytes from beginning of myStrings
(myStrings + 1) -> 0x0061FF18 // 4 bytes from beginning of myStrings

myStrings[0] -> 0x0061FF1C // de-references myStrings @ 0 returning the address that points to the beginning of 'Hello'
myStrings[1] -> 0x0061FF21 // de-references myStrings @ 1 returning the address that points to the beginning of 'World'

// The address of each letter is 1 char, or 1 byte apart
myStrings[0] + 0 -> 0x0061FF1C  which means... *(myStrings[0] + 0) = 'H'
myStrings[0] + 1 -> 0x0061FF1D  which means... *(myStrings[0] + 1) = 'e'
myStrings[0] + 2 -> 0x0061FF1E  which means... *(myStrings[0] + 2) = 'l'
myStrings[0] + 3 -> 0x0061FF1F  which means... *(myStrings[0] + 3) = 'l'
myStrings[0] + 4 -> 0x0061FF20  which means... *(myStrings[0] + 4) = 'o'
🌐
W3Schools
w3schools.com › cpp › cpp_intro.asp
C++ Introduction
Declare Variables Multiple Variables Identifiers Constants Real-Life Examples C++ User Input C++ Data Types
🌐
Wikipedia
en.wikipedia.org › wiki › C+
C+ - Wikipedia
October 23, 2025 - Canal+ (disambiguation), French company Groupe Canal+ and its subsidiaries all bearing the brand name · Faster-than-light travel, above the speed of light, c · C augmented triad, a chord made up of the notes C, E, and G#. Search for "c+" or "c-plus" on Wikipedia.
🌐
Quora
quora.com › What-does-mean-in-C-before-a-variable
What does ** mean in C before a variable? - Quora
Answer (1 of 4): First will try to understand the Pointer ( * ) What is pointer - Pointer is a variable that stores/points the address of another variable Yes it is like a variable but it can store only the address not the data. Lets see an example, Here we have a variable called A, [code]int...
🌐
Legal Information Institute
law.cornell.edu › lii › federal rules of civil procedure › rule 26. duty to disclose; general provisions governing discovery
Rule 26. Duty to Disclose; General Provisions Governing Discovery | Federal Rules of Civil Procedure | US Law | LII / Legal Information Institute
(i) the name and, if known, the address and telephone number of each individual likely to have discoverable information—along with the subjects of that information—that the disclosing party may use to support its claims or defenses, unless the use would be solely for impeachment;
🌐
RDocumentation
rdocumentation.org › packages › base › versions › 3.6.2 › topics › c
c function - RDocumentation
This is a generic function which combines its arguments. The default method combines its arguments to form a vector. All arguments are coerced to a common type which is the type of the returned value, and all attributes except names are removed.