720 views

1 Answer

Best answer
7 votes
7 votes

C) 0 0 1 will be output. 

int main(){
    static int arr[20]; //Default Initial Value for static variable is
                        // 0, hence each block will get 0 value
    int x=0;
    arr[x] = x++;       // Here x++ is a post increment, hence it will get 
                        // Incremented after applying value of x to arr[x] hence
                        // arr[0] will get 0, then X get incremented. 
                        
    printf("\n %d %d %d", arr[0],arr[1],x); 
}
selected by

Related questions

0 votes
0 votes
2 answers
1
Desert_Warrior asked May 16, 2016
2,944 views
#include <stdio.h int main() { char p; char buf[10] = {1, 2, 3, 4, 5, 6, 9, 8}; p = (buf + 1)[5]; printf("%d\n", p); return 0; }(a) 5 (b) 6 (c) 9 (d) none of the above
0 votes
0 votes
1 answer
3
Desert_Warrior asked Jun 4, 2016
589 views
0 votes
0 votes
1 answer
4
Desert_Warrior asked Jun 2, 2016
681 views
void main() { int i=100,j=10,k; int *p=&j; k=i/(*p); printf("%d",k); }OPTIONS : [ a] 0 [b] 10 [c] 100 [d] None of the above