there is two conditions ,
1. while using for loop for printing 1 to 50 no's simulteneous
2. while using printf functios for printing 1 to 50 no's simulteneous with or without using variables
who will take more time for compiling and execution?
explain in details with reason?
Answer / avanish pal
For loop will take more time for compiling and execution
because when we execute the program, flow of control frist
print 1 and after that returns to the condition and than
printed 2 this process repeated 50 times where as in simple
printf it straight print all numbers.
| Is This Answer Correct ? | 2 Yes | 0 No |
#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++j); printf("%d %d %d", i,j,k); } what will the values of i , j and k? }
14 Answers CDAC, GATE, NDS, TCS,
what is the purpose of the following code, and is there any problem with the code? void fn(long* p1, long* p2) { register int x = *p1; register int y = *p2; x ^= y; y ^= x; x ^= y; *p1 = x; *p2 = y; }
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }
Explain the use of function toupper() with and example code?
User define function contain thier own address or not.
what is the output of following question? void main() { int i=0,a[3]; a[i]=i++; printf("%d",a[i] }
Explain output of printf("Hello World"-'A'+'B'); ?
What is the real difference between arrays and pointers?
27 Answers Hexaware, Logic Pro, TCS,
what do structure language means?
Give the rules for variable declaration?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2