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() { unsigned int i=65000; while(i++!=0); printf("%d",i); }
main(){ char a[100]; a[0]='a';a[1]]='b';a[2]='c';a[4]='d'; abc(a); } abc(char a[]){ a++; printf("%c",*a); a++; printf("%c",*a); }
Write a C program that defines a 2-dimentional integer array called A [50][50]. Then the elements of this array should randomly be initialized either to 1 or 0. The program should then print out all the elements in the diagonal (i.e. a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally, print out how many zeros and ones in the diagonal.
Is it possible to type a name in command line without ant quotes?
#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }
union u { union u { int i; int j; }a[10]; int b[10]; }u; main() { printf("\n%d", sizeof(u)); printf(" %d", sizeof(u.a)); // printf("%d", sizeof(u.a[4].i)); } a. 4, 4, 4 b. 40, 4, 4 c. 1, 100, 1 d. 40 400 4
write a program for area of circumference of shapes
Cau u say the output....?
main() { { unsigned int bit=256; printf("%d", bit); } { unsigned int bit=512; printf("%d", bit); } } a. 256, 256 b. 512, 512 c. 256, 512 d. Compile error
main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }
main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }
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 ??