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

I still don't understand the difference between "&" and "*" in C.
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." More on reddit.com
🌐 r/learnprogramming
14
17
April 18, 2022
What is the '-->' operator in C/C++? - Stack Overflow
After reading Hidden Features and Dark Corners of C++/STL on comp.lang.c++.moderated, I was completely surprised that the following snippet compiled and worked in both Visual Studio 2008 and G++ 4.... More on stackoverflow.com
🌐 stackoverflow.com
microcontroller - What do the C operators "&=" and "|=" do? - Electrical Engineering Stack Exchange
Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... \$\begingroup\$ I don't believe those operators are any different between micros and other platforms. \$\endgroup\$ ... \$\begingroup\$ For the complete masterclass graphics.stanford.edu/~se... More on electronics.stackexchange.com
🌐 electronics.stackexchange.com
June 2, 2011
Pointers in C: when to use the ampersand and the asterisk? - Stack Overflow
I'm just starting out with pointers, and I'm slightly confused. I know & means the address of a variable and that * can be used in front of a pointer variable to get the value of the object tha... More on stackoverflow.com
🌐 stackoverflow.com
🌐
C-in
c-in.eu
C-IN | Professional Congress Organiser
At C-IN, we go beyond organizing events.
🌐
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;
🌐
C-IN2
c-in2.com › home
Men’s Underwear by C-IN2 | Briefs, Boxers, Jocks & More
C-IN2 (pronounced “see-into”) makes high-quality men’s underwear, t-shirts, and tanks—engineered for comfort, elevated with fashion-forward style, and built to move. With sculpted fits, breathable fabrics, and confident design, our gear blends performance and polish.
🌐
Facebook
facebook.com › cin.europe
C-IN | Prague
C-IN, Prague, Czech Republic. 491 likes · 32 talking about this · 72 were here. Meet C-IN! Specialists in conference, association and corporate event management. 🤝
Find elsewhere
🌐
Wikipedia
en.wikipedia.org › wiki › Operators_in_C_and_C++
Operators in C and C++ - Wikipedia
2 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.
🌐
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
October 18, 2025 - 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.
🌐
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.
🌐
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 ...
🌐
Pragueconvention
pragueconvention.cz › news › c-in-concluded-this-years-parliament-events-within-the-czech-presidency-in-the-european-council
C-IN Concluded this Year´s Parliament Events within the Czech Presidency in the European Council – Prague Convention Bureau
Conference of Parliamentary Committees for Union Affairs of Parliaments of the European Union (COSAC) was last Parliament event within the Czech Presidency in the European Council this year. It was brought by C-IN together with the Office of the Chamber of Deputies of the Czech Republic from the 13th till the 15th of November in Prague.
🌐
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.
🌐
GeeksforGeeks
geeksforgeeks.org › c language › increment-and-decrement-operators-in-c
Increment and Decrement Operators in C - GeeksforGeeks
May 21, 2025 - The increment ( ++ ) and decrement ( -- ) operators in C are unary operators for incrementing and decrementing the numeric values by 1, respectively.
Top answer
1 of 10
770

You have pointers and values:

int* p; // variable p is pointer to integer type
int i; // integer value

You turn a pointer into a value with *:

int i2 = *p; // integer i2 is assigned with integer value that pointer p is pointing to

You turn a value into a pointer with &:

int* p2 = &i; // pointer p2 will point to the integer i

Edit: In the case of arrays, they are treated very much like pointers. If you think of them as pointers, you'll be using * to get at the values inside of them as explained above, but there is also another, more common way using the [] operator:

int a[2];  // array of integers
int i = *a; // the value of the first element of a
int i2 = a[0]; // another way to get the first element

To get the second element:

int a[2]; // array
int i = *(a + 1); // the value of the second element
int i2 = a[1]; // the value of the second element

So the [] indexing operator is a special form of the * operator, and it works like this:

a[i] == *(a + i);  // these two statements are the same thing
2 of 10
43

There is a pattern when dealing with arrays and functions; it's just a little hard to see at first.

When dealing with arrays, it's useful to remember the following: when an array expression appears in most contexts, the type of the expression is implicitly converted from "N-element array of T" to "pointer to T", and its value is set to point to the first element in the array. The exceptions to this rule are when the array expression appears as an operand of either the & or sizeof operators, or when it is a string literal being used as an initializer in a declaration.

Thus, when you call a function with an array expression as an argument, the function will receive a pointer, not an array:

int arr[10];
...
foo(arr);
...

void foo(int *arr) { ... }

This is why you don't use the & operator for arguments corresponding to "%s" in scanf():

char str[STRING_LENGTH];
...
scanf("%s", str);

Because of the implicit conversion, scanf() receives a char * value that points to the beginning of the str array. This holds true for any function called with an array expression as an argument (just about any of the str* functions, *scanf and *printf functions, etc.).

In practice, you will probably never call a function with an array expression using the & operator, as in:

int arr[N];
...
foo(&arr);

void foo(int (*p)[N]) {...}

Such code is not very common; you have to know the size of the array in the function declaration, and the function only works with pointers to arrays of specific sizes (a pointer to a 10-element array of T is a different type than a pointer to a 11-element array of T).

When an array expression appears as an operand to the & operator, the type of the resulting expression is "pointer to N-element array of T", or T (*)[N], which is different from an array of pointers (T *[N]) and a pointer to the base type (T *).

When dealing with functions and pointers, the rule to remember is: if you want to change the value of an argument and have it reflected in the calling code, you must pass a pointer to the thing you want to modify. Again, arrays throw a bit of a monkey wrench into the works, but we'll deal with the normal cases first.

Remember that C passes all function arguments by value; the formal parameter receives a copy of the value in the actual parameter, and any changes to the formal parameter are not reflected in the actual parameter. The common example is a swap function:

void swap(int x, int y) { int tmp = x; x = y; y = tmp; }
...
int a = 1, b = 2;
printf("before swap: a = %d, b = %d\n", a, b);
swap(a, b);
printf("after swap: a = %d, b = %d\n", a, b);

You'll get the following output:

before swap: a = 1, b = 2
after swap: a = 1, b = 2

The formal parameters x and y are distinct objects from a and b, so changes to x and y are not reflected in a and b. Since we want to modify the values of a and b, we must pass pointers to them to the swap function:

void swap(int *x, int *y) {int tmp = *x; *x = *y; *y = tmp; }
...
int a = 1, b = 2;
printf("before swap: a = %d, b = %d\n", a, b);
swap(&a, &b);
printf("after swap: a = %d, b = %d\n", a, b);

Now your output will be

before swap: a = 1, b = 2
after swap: a = 2, b = 1

Note that, in the swap function, we don't change the values of x and y, but the values of what x and y point to. Writing to *x is different from writing to x; we're not updating the value in x itself, we get a location from x and update the value in that location.

This is equally true if we want to modify a pointer value; if we write

int myFopen(FILE *stream) {stream = fopen("myfile.dat", "r"); }
...
FILE *in;
myFopen(in);

then we're modifying the value of the input parameter stream, not what stream points to, so changing stream has no effect on the value of in; in order for this to work, we must pass in a pointer to the pointer:

int myFopen(FILE **stream) {*stream = fopen("myFile.dat", "r"); }
...
FILE *in;
myFopen(&in);

Again, arrays throw a bit of a monkey wrench into the works. When you pass an array expression to a function, what the function receives is a pointer. Because of how array subscripting is defined, you can use a subscript operator on a pointer the same way you can use it on an array:

int arr[N];
init(arr, N);
...
void init(int *arr, int N) {size_t i; for (i = 0; i < N; i++) arr[i] = i*i;}

Note that array objects may not be assigned; i.e., you can't do something like

int a[10], b[10];
...
a = b;

so you want to be careful when you're dealing with pointers to arrays; something like

void (int (*foo)[N])
{
  ...
  *foo = ...;
}

won't work.

🌐
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.
🌐
C-in
c-in.eu › company
Company | C-IN
I can fully recommend C-IN to medical and other scientific societies looking for a service provider that is large enough to efficiently cover administrative and operational tasks, and small enough to offer a personal touch in their interactions. ... We believe that C-IN’s commitment to education and quality certification is the cornerstone of success.
🌐
LinkedIn
cz.linkedin.com › company › c-in
C-IN | LinkedIn
C-IN provides the highest level of services, specializing in event, congress and association management. Our team of 53 people delivers more than 50 events per year and acts as a long term partner for several European associations.