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 |
Predict the Output: int main() { int *p=(int *)2000; scanf("%d",2000); printf("%d",*p); return 0; } if input is 20 ,what will be print
posted by surbhi just now main() { float a = 5.375; char *p; int i; p=(char*)&a; for(i=0;i<=3;i++) printf("%02x",(unsigned char) p[i]); } how is the output of this program is :: 0000ac40 please let me know y this output has come
Write a program that reads a dynamic array of 40 integers and displays only even integers
main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }
9 Answers CSC, GoDB Tech, IBM,
program to find magic aquare using array
given integer number,write a program that displays the number as follows: First line :all digits second line : all except the first digit . . . . Last line : the last digit
can u give me the c codings for converting a string into the hexa decimal form......
#ifdef something int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }
What are the following notations of defining functions known as? i. int abc(int a,float b) { /* some code */ } ii. int abc(a,b) int a; float b; { /* some code*/ }
how to return a multiple value from a function?
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
write a program to find out roots of quadratic equation "x=-b+-(b^2-4ac0^-1/2/2a"