What is the void* pointer of C language?
This article mainly explains "what is the void* pointer of c language", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "what is the void* pointer of c language"!
1. void* pointer is a pointer, which also points to the data of an address in memory, but the data type in memory is uncertain, so it needs to be converted when used.
void means no type, is a pointer without type, can point to any type of data.
Therefore void pointers are often referred to as universal pointers or pan pointers, or universal pointers.
examples
#include int main(void){ int num1 = 1; char char1 = 'b'; /* Define two void pointer types */ void *void_pointer_1; void *void_pointer_2; /* Give different void pointers to different data types */ void_pointer_1 = &num1; void_pointer_2 = &char1; printf("void_pointer_1:%d,void_pointer_2:%c\n",*((int *)void_pointer_1),*((char *)void_pointer_2)); void_pointer_2 = &num1; printf("void_pointer1:%d\n",*((int *)(void_pointer_2))); float float_1 = 1.25f; float* float_pointer = &float_1; void* void_float_pointer ; /** Assign float type pointer to void type pointer */ void_float_pointer = float_pointer; printf("float_pointer:%f\n",*((float *)void_float_pointer)); return 0;} At this point, I believe that everyone has a deeper understanding of "what is the void* pointer of c language". Let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!