main( )

{

void *vp;

char ch = ‘g’, *cp = “goofy”;

int j = 20;

vp = &ch;

printf(“%c”, *(char *)vp);

vp = &j;

printf(“%d”,*(int *)vp);

vp = cp;

printf(“%s”,(char *)vp + 3);

}

Answer Posted / susie

Answer :

g20fy

Explanation:

Since a void pointer is used it can be type casted to any
other type pointer. vp = &ch stores address of char ch and
the next statement prints the value stored in vp after type
casting it to the proper data type pointer. the output is
‘g’. Similarly the output from second printf is ‘20’. The
third printf statement type casts it to print the string
from the 4th value hence the output is ‘fy’.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

2128


write a simple calculator c program to perform addition, subtraction, mul and div.

3384


Design an implement of the inputs functions for event mode

3164


Write a routine to implement the polymarker function

4581


What is data _null_? ,Explain with code when u need to use it in data step programming ?

3011






How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

2252


why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?

2497


How to palindrom string in c language?

9776


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

729


why nlogn is the lower limit of any sort algorithm?

2541


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

3073


can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

2564


Develop a routine to reflect an object about an arbitrarily selected plane

3274


Write a program to model an exploding firecracker in the xy plane using a particle system

3866


write a program for area of circumference of shapes

2225