main()
{
int i, j, *p;
i = 25;
j = 100;
p = &i; // Address of i is assigned to pointer p
printf("%f", i/(*p) ); // i is divided by pointer p
}
a. Runtime error.
b. 1.00000
c. Compile error
d. 0.00000
Answers were Sorted based on User's Feedback
Answer / rk
d) it will print 0.0000.
If we typecast the result to float as shown below then
expected output will be printed(i.e. 1.0000)
printf("%f",(float) i/(*p) ); // i is divided by pointer p
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / guest
c) Error becoz i/(*p) is 25/25 i.e 1 which is int & printed
as a float,
So abnormal program termination,
runs if (float) i/(*p) -----> Type Casting
Is This Answer Correct ? | 6 Yes | 2 No |
Answer / km
the answer to this question is implementation dependent:
if tried in Turbo C++
a) Runtime error
abnormal termination
if tried in Unix using GNU C
non of the above
you get a junk result
Is This Answer Correct ? | 2 Yes | 0 No |
main() { int k=1; printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE"); }
Write a program to implement the motion of a bouncing ball using a downward gravitational force and a ground-plane friction force. Initially the ball is to be projected in to space with a given velocity vector
How to count a sum, when the numbers are read from stdin and stored into a structure?
why is printf("%d %d %d",i++,--i,i--);
write a program in c to merge two array
#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }
What is "far" and "near" pointers in "c"...?
void main() { int const * p=5; printf("%d",++(*p)); }
3 Answers Infosys, Made Easy, State Bank Of India SBI,
write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??
Cau u say the output....?
main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }
Finding a number which was log of base 2