void main()
{
static int i=i++, j=j++, k=k++;
printf(“i = %d j = %d k = %d”, i, j, k);
}
Answers were Sorted based on User's Feedback
Answer / susie
Answer :
i = 1 j = 1 k = 1
Explanation:
Since static variables are initialized to zero by default.
Is This Answer Correct ? | 12 Yes | 8 No |
Answer / mittu
0 ,0 ,0
It gives 0 0 0 for all three.
Cause at compile time compiler assigns memory to the static variable in HEAP. So these are automatically initialized to 0.
So First Allocation and then Initialization takes place.
At compile time it allocates memory to i,j,k.
And then initialization phase first is assigns 0 to 'i','j' and 'k' and
then it uses this ++ for increment the value at "Increment Buffer".
So i,j,k are initialized by 0 and value of i , j,k is incremented by 1 in "Increment Buffer".
THIS IS DONE AT COMPILE TIME.
Now at run time it refers the value of i,j and k from HEAP.
And at run time it skips "static statements".
So in HEAP value of i , j, and k is 0(zero).
Is This Answer Correct ? | 5 Yes | 1 No |
main() { int x=5; clrscr(); for(;x==0;x--) { printf("x=%d\n”", x--); } } a. 4, 3, 2, 1, 0 b. 1, 2, 3, 4, 5 c. 0, 1, 2, 3, 4 d. none of the above
Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?
#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d..%d",*p,*q); }
main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }
Write a program that produces these three columns sequence nos. using loop statement Sequence nos. Squared Squared + 5 1 1 6 2 4 9 3 9 14 4 16 21 5 25 30
Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines
#define assert(cond) if(!(cond)) \ (fprintf(stderr, "assertion failed: %s, file %s, line %d \n",#cond,\ __FILE__,__LINE__), abort()) void main() { int i = 10; if(i==0) assert(i < 100); else printf("This statement becomes else for if in assert macro"); }
# include <stdio.h> int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); }
What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql
void main() { int const * p=5; printf("%d",++(*p)); }
3 Answers Infosys, Made Easy, State Bank Of India SBI,
char *someFun() { char *temp = “string constant"; return temp; } int main() { puts(someFun()); }
main( ) { static int a[ ] = {0,1,2,3,4}; int *p[ ] = {a,a+1,a+2,a+3,a+4}; int **ptr = p; ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *++ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); ++*ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); }