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 |
Write a c program to search an element in an array using recursion
What is data _null_? ,Explain with code when u need to use it in data step programming ?
1) int i=5; j=i++ + i++ + i++; printf("%d",j);This code gives the answer 15.But if we replace the value of the j then anser is different?why? 2)int i=5; printf("%d",i++ + i++ + i++); this givs 18.
#include<stdio.h> #include<conio.h> void main() { int a=(1,2,3,(1,2,3,4); switch(a) { printf("ans:"); case 1: printf("1");break; case 2: printf("2");break; case 3: printf("1");break; case 4: printf("4");break; printf("end"); } getch(); }
Write a C program to add two numbers before the main function is called.
void main() { unsigned giveit=-1; int gotit; printf("%u ",++giveit); printf("%u \n",gotit=--giveit); }
why is printf("%d %d %d",i++,--i,i--);
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 ?
what is the code of the output of print the 10 fibonacci number series
abcdedcba abc cba ab ba a a
How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?
void main() { int i=5; printf("%d",i+++++i); }