C Exercises: Show a pointer to union
19. Pointer to a Union
Write a program in C to show a pointer to a union.
Visual Presentation:

Sample Solution:
C Code:
Sample Output:
Pointer : Show a pointer to union : ---------------------------------------- Jhon Mc Jhon Mc
Flowchart:

For more Practice: Solve these Related Problems:
- Write a C program to declare a union and use a pointer to access and modify its members.
- Write a C program to demonstrate how a union works by assigning values to different members via a pointer.
- Write a C program to use a pointer to a union to display the same memory in different formats.
- Write a C program to show the effect of updating one union member on the values of other members using a pointer.
C Programming Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a program in C to show the usage of pointer to structure.
Next: Write a program in C to show a pointer to an array which contents are pointer to structure.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.