07 C | How to convert void pointer into char int float double

Published: 01 March 2014
on channel: Yusuf Shakeel
17,198
90

Pointer are powerful stuff in C programming. You get direct access to variable address. VOID POINTERS are special type of pointers. They can take address of any kind of data type - char, int, float or double. And you can also get the value back from void pointers.

In this video we will see how to convert the fundamental data type of C into void pointer and then retrieve the value back.

This video assumes that you have some knowledge of C programming. If you are new to C and want to learn the language then I will suggest you to read any of the following books
The C Programming Language by Kernighan and Ritchie
ANSI C Balaguruswamy
The Complete Reference C by Herbert Schildt

0:05 char to void pointer and reverse
0:10 Declaring and initializing char variable ch
0:20 Declaring void pointer variable v
0:30 Assigning the address of variable ch to void pointer v
0:45 Declaring char variable p that takes the value of ch through void pointer v
1:12 Printing the value of ch which is now stored in p
1:27 Compile and Run program

1:36 int to void pointer and reverse
1:44 Declaring and initializing int variable i
1:52 Declaring void pointer variable v
1:59 Assigning the address of variable i to void pointer v
2:14 Declaring int variable p that takes the value of i through void pointer v
2:34 Printing the value of i which is now stored in p
2:52 Compile and Run program

2:59 float to void pointer and reverse
3:06 Declaring and initializing float variable f
3:15 Declaring void pointer variable v
3:19 Assigning the address of variable f to void pointer v
3:32 Declaring int variable p that takes the value of f through void pointer v
3:55 Printing the value of f which is now stored in p
4:12 Compile and Run program

4:19 double to void pointer and reverse
4:25 Declaring and initializing double variable d
4:35 Declaring void pointer variable v
4:40 Assigning the address of variable d to void pointer v
4:52 Declaring int variable p that takes the value of d through void pointer v
5:16 Printing the value of d which is now stored in p
5:32 Compile and Run program

You can download the project code from my GitHub repository
https://github.com/yusufshakeel/C-Pro...


Watch video 07 C | How to convert void pointer into char int float double online, duration hours minute second in high quality that is uploaded to the channel Yusuf Shakeel 01 March 2014. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 17,198 times and liked it 90 visitors.