Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Void | Pointers
course content

Course Content

C Basics

VoidVoid

We've previously encountered void when we looked at functions that don't return anything or just display text on the screen.

Keep in mind that we can't declare a variable of the void type. However, we can create a void* pointer that points to a memory location.

Note

If you've worked through the pointer exercises in the section, you'll know that all pointers occupy 8 bytes. A void* pointer is no different.

A void* pointer isn't tied to any specific data type. This flexibility allows us to store the address of any data type in it.

However, there's a catch: we can't dereference a void* pointer.

Note

This limitation stems from the same reason we can't declare variables of the void type.

Perform an explicit type conversion!

c

Main.c

Congratulations on completing the basic course in C programming! If you're eager to dive deeper into this fascinating and logical programming language, I highly recommend delving into topics like macros, sorting algorithms, and data structures. Additionally, familiarizing yourself with one of the Linux distributions is invaluable for any seasoned C programmer.

You might also want to consider the Introduction to C++ course. Given that C++ builds upon C, this programming language will offer an expanded set of possibilities.

Best of luck!

How do you retrieve the value of a void pointer?

Select the correct answer

Everything was clear?

Section 6. Chapter 6
course content

Course Content

C Basics

VoidVoid

We've previously encountered void when we looked at functions that don't return anything or just display text on the screen.

Keep in mind that we can't declare a variable of the void type. However, we can create a void* pointer that points to a memory location.

Note

If you've worked through the pointer exercises in the section, you'll know that all pointers occupy 8 bytes. A void* pointer is no different.

A void* pointer isn't tied to any specific data type. This flexibility allows us to store the address of any data type in it.

However, there's a catch: we can't dereference a void* pointer.

Note

This limitation stems from the same reason we can't declare variables of the void type.

Perform an explicit type conversion!

c

Main.c

Congratulations on completing the basic course in C programming! If you're eager to dive deeper into this fascinating and logical programming language, I highly recommend delving into topics like macros, sorting algorithms, and data structures. Additionally, familiarizing yourself with one of the Linux distributions is invaluable for any seasoned C programmer.

You might also want to consider the Introduction to C++ course. Given that C++ builds upon C, this programming language will offer an expanded set of possibilities.

Best of luck!

How do you retrieve the value of a void pointer?

Select the correct answer

Everything was clear?

Section 6. Chapter 6
some-alt