They're bit-fields, an example being that unsigned int addr:9; creates an addr field 9 bits long.

It's commonly used to pack lots of values into an integral type. In your particular case, it defining the structure of a 32-bit microcode instruction for a (possibly) hypothetical CPU (if you add up all the bit-field lengths, they sum to 32).

The union allows you to load in a single 32-bit value and then access the individual fields with code like (minor problems fixed as well, specifically the declarations of code and test):

#include <stdio.h>

struct microFields {
    unsigned int addr:9;
    unsigned int cond:2;
    unsigned int wr:1;
    unsigned int rd:1;
    unsigned int mar:1;
    unsigned int alu:3;
    unsigned int b:5;
    unsigned int a:5;
    unsigned int c:5;
};

union micro {
    unsigned int microCode;
    struct microFields code;
};

int main (void) {
    int myAlu;
    union micro test;
    test.microCode = 0x0001c000;
    myAlu = test.code.alu;
    printf("%d\n",myAlu);
    return 0;
}

This prints out 7, which is the three bits making up the alu bit-field.

Answer from paxdiablo on Stack Overflow
🌐
W3Schools
w3schools.com › c › c_operators.php
C Operators
int sum1 = 100 + 50; // 150 (100 + 50) int sum2 = sum1 + 250; // 400 (150 + 250) int sum3 = sum2 + sum2; // 800 (400 + 400) Try it Yourself » · C divides the operators into the following groups:
Discussions

arrays - What does ** do in C language? - Stack Overflow
I know I'm missing something, and ... ] or char ** as seen bellow: ... You'd want a pointer to a pointer for the same reason you'd want a pointer to anything. For example, to modify the pointer it points to. ... Pointers to pointers make perfect sense, and they're used all the time. Also, int is not always ... More on stackoverflow.com
🌐 stackoverflow.com
c++ - What's the difference between * and & in C? - Stack Overflow
I'm learning C and I'm still not sure if I understood the difference between & and * yet. Allow me to try to explain it: int a; // Declares a variable int *b; // Declares a pointer int &c... More on stackoverflow.com
🌐 stackoverflow.com
Could someone explain the use of the asterisk * in C and how it is used?
Is it just that it means different things depending on how it is used Yes. Just like it can also mean multiplication. int* a = malloc(5 * sizeof(*a)); ^ ^ ^ Dereferencing "Pointer to" Multiplication More on reddit.com
🌐 r/C_Programming
18
9
April 26, 2022
The C in DC already stands for Comics, so why we call it DC "comics" : BatmanArkham
🌐 r/BatmanArkham

They're bit-fields, an example being that unsigned int addr:9; creates an addr field 9 bits long.

It's commonly used to pack lots of values into an integral type. In your particular case, it defining the structure of a 32-bit microcode instruction for a (possibly) hypothetical CPU (if you add up all the bit-field lengths, they sum to 32).

The union allows you to load in a single 32-bit value and then access the individual fields with code like (minor problems fixed as well, specifically the declarations of code and test):

#include <stdio.h>

struct microFields {
    unsigned int addr:9;
    unsigned int cond:2;
    unsigned int wr:1;
    unsigned int rd:1;
    unsigned int mar:1;
    unsigned int alu:3;
    unsigned int b:5;
    unsigned int a:5;
    unsigned int c:5;
};

union micro {
    unsigned int microCode;
    struct microFields code;
};

int main (void) {
    int myAlu;
    union micro test;
    test.microCode = 0x0001c000;
    myAlu = test.code.alu;
    printf("%d\n",myAlu);
    return 0;
}

This prints out 7, which is the three bits making up the alu bit-field.

Answer from paxdiablo on Stack Overflow
🌐
Reddit
reddit.com › r/learnprogramming › i still don't understand the difference between "&" and "*" in c.
r/learnprogramming on Reddit: I still don't understand the difference between "&" and "*" in C.
April 18, 2022 -

So I know roughly how pointers work. You have a value, say char x, and doing char* x isn't the actual content of the variable but rather the physical address it's located at.

But the thing that really confuses me is where we use "&" versus "*". I know "&" corresponds to the memory location of something, but isn't that what the pointer operator does? Just gives you the memory address of a variable? When exactly do we use "&" and "*"?

Is the pointer operator just for defining pointer "objects" (in a sense) while the ampersand is done as a way of reading a memory address versus operating with it?

Top answer
1 of 5
26
The problem is that * and & have like, three different meanings (more if you're in C++ land). * in a type name means "this is a pointer to the given type." So an int * is a pointer to an int, and an int ** is a pointer to a pointer to an int. * between two expressions is the multiplication operator. (2 + 3) * (4 + 6) is 50. * at the start of an expression or variable name is the "splat" or derefencing operator. *foo means "follow the pointer foo and see what's contained at the address it points to." So something like this: int foo = 3; int *bar = &foo; printf("%d\n", *bar); prints 3. & in a type name has no meaning in C, but in C++ it declares a reference type, which is like a pointer but with stronger semantics. & between two expressions is the bitwise AND operator. You can think of it as taking two numbers, converting them to binary, ANDing all their bits together, and returning you the resultant value. So something like this: 0b1101 & 0b1010 would return 0b1000 & at the beginning of an expression or variable name is the "pointer-to" operator. Like the name suggests, this will give you back a pointer to the proceeding value. So something like &foo means "give me the address of foo as a pointer." You can see a use of this operator in the last example for *; it's essentially the inverse of "splat."
2 of 5
6
& says "give me the address of a thing that exists" "*" says either: "take a thing that's a pointer and treat it like an object (i.e. i = *ptr;" OR "declare a pointer to an object (i.e. int *a = NULL;) Combined example: int x = 7; int *b = &x; *b = 9;
🌐
Wikipedia
en.wikipedia.org › wiki › Operators_in_C_and_C++
Operators in C and C++ - Wikipedia
4 days ago - This is a list of operators in the C and C++ programming languages. All listed operators are in C++ and lacking indication otherwise, in C as well. Some tables include a "In C" column that indicates whether an operator is also in C. Note that C does not support operator overloading.
🌐
W3Schools
w3schools.com › c › c_comments.php
C Comments
Good to know: Before version C99 (released in 1999), you could only use multi-line comments in C.
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › cprogramming › c_operators.htm
C - Operators
The most common logical operators are AND (&&), OR(||), and NOT (!). Logical operators are also binary operators. ... We will discuss more about Logical Operators in C in a subsequent chapter.
🌐
Programiz
programiz.com › c-programming › c-input-output
C Input/Output: printf() and scanf()
Become a certified C programmer. Try Programiz PRO! ... In C programming, printf() is one of the main output function. The function sends formatted output to the screen.
🌐
Learn X in Y Minutes
learnxinyminutes.com › c
Learn C in Y Minutes
// Your program's entry point is a function called "main". The return type can // be anything, however most operating systems expect a return type of `int` for // error code processing.
🌐
Quora
quora.com › What-does-in-C-programming-mean
What does “&*” in C programming mean? - Quora
Answer (1 of 4): Assuming unary * and unary &, it means to take the address of the dereferenced object. In C, it’s effectively a no-op. T̶h̶a̶t̶ ̶s̶a̶i̶d̶,̶ ̶i̶f̶ ̶t̶h̶e̶ ̶a̶r̶g̶u̶m̶e̶n̶t̶ ̶o̶f̶ ̶t̶h̶e̶ ̶d̶e̶r̶e̶f̶e̶r̶e̶n̶c̶e̶ ̶o̶p̶e̶r̶a̶t̶o̶r̶ ̶d̶o̶e̶s̶n̶’̶t̶ ̶p̶o̶i̶n̶t̶ ̶t̶o̶ ̶a̶ ̶v̶a̶l̶i̶d̶ ̶...
🌐
Programiz
programiz.com › c-programming › c-operators
Operators in C
April 27, 2022 - An operator is a symbol that operates on a value or a variable. For example: + is an operator to perform addition. In this tutorial, you will learn about different C operators such as arithmetic, increment, assignment, relational, logical, etc. with the help of examples.
🌐
JetBrains
jetbrains.com › clion
CLion: A cross-platform IDE for C and C++
June 1, 2021 - Boost your productivity with CLion’s smart code assistance, deep language insight, extensive build system support, advanced debugging, and features for embedded development.
🌐
OneCompiler
onecompiler.com › c
C Online Compiler
C language is one of the most popular general-purpose programming language developed by Dennis Ritchie at Bell laboratories for UNIX operating system. The initial release of C Language was in the year 1972.
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'
🌐
GeeksforGeeks
geeksforgeeks.org › c language › c-language-introduction
C Language Introduction - GeeksforGeeks
It is the entry point of a C program and the execution typically begins with the first line of the main(). The empty brackets indicate that the main doesn't take any parameter (See this for more details). The int that was written before the main indicates the return type of main().
Published   October 31, 2025
🌐
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!

🌐
GeeksforGeeks
geeksforgeeks.org › c language › operators-in-c
Operators in C - GeeksforGeeks
Unary Operators: Operators that work on single operand. Example: Increment( ++ ) , Decrement( -- ) Binary Operators: Operators that work on two operands. Example: Addition ( + ), Subtraction( - ) , Multiplication ( * ) Ternary Operators: Operators ...
Published   November 1, 2025
🌐
Wikipedia
en.wikipedia.org › wiki › In_C
In C - Wikipedia
2 days ago - In C is a composition by Terry Riley from 1964. It is one of the most successful works by an American composer and a seminal example of minimalism. The score directs any number of musicians to repeat a series of 53 melodic fragments in a guided improvisation.
🌐
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...
🌐
Learn C
learn-c.org
Learn C - Free Interactive C Tutorial
learn-c.org is a free interactive C tutorial for people who want to learn C, fast.