in Technology by
What is the advantage of a void pointer in C?

1 Answer

0 votes
by

There are following advantages of a void pointer in c.

  • Using the void pointer we can create a generic function that can take arguments of any data type. The memcpy and memmove library function are the best examples of the generic function, using these functions we can copy the data from the source to destination.
  • We know that void pointer can be converted to another data type that is the reason malloc, calloc or realloc library function return void *. Due to the void * these functions are used to allocate memory to any data type.
  • Using the void * we can create a generic linked list..

 

Related questions

0 votes
    What is the size of a void pointer in C?...
asked Jan 21, 2021 in Technology by JackTerrance
+1 vote
    What is the advantage of declaring void pointers in C-Programming?...
asked Nov 9, 2020 in Technology by JackTerrance
0 votes
    Can math operations be performed on a void pointer?...
asked Jan 22, 2021 in Technology by JackTerrance
0 votes
    What is (void*)0? Error re of null pointer re of void pointer none of the listed options? Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
0 votes
    What is the advantage of declaring void pointers?...
asked Jan 17, 2021 in Technology by JackTerrance
0 votes
    What is void or Generic pointers in C?...
asked Jan 21, 2021 in Technology by JackTerrance
0 votes
    Which is a valid declaration within an interface? A)protected short stop = 23; b)final void madness(short stop); ... (double duty);? Select the correct answer from above options...
asked Dec 1, 2021 in Education by JackTerrance
0 votes
    What is Indirection and Increment/Decrement operators with a pointer in C?...
asked Jan 24, 2021 in Technology by JackTerrance
0 votes
    How can we do Pointer comparison in C?...
asked Jan 24, 2021 in Technology by JackTerrance
0 votes
    How is a Program increment a pointer in C?...
asked Jan 24, 2021 in Technology by JackTerrance
0 votes
    Which type of pointer is the most convenient way of storing the raw address in C programming?...
asked Jan 23, 2021 in Technology by JackTerrance
0 votes
    What is the use of a double pointer (pointer to pointer) in C?...
asked Jan 22, 2021 in Technology by JackTerrance
0 votes
    How to declare a pointer to a function in C?...
asked Jan 22, 2021 in Technology by JackTerrance
0 votes
    What is the usage of the NULL pointer in C?...
asked Jan 21, 2021 in Technology by JackTerrance
0 votes
    What is a near pointer in C?...
asked Jan 21, 2021 in Technology by JackTerrance
...