The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
19 views
What will be the value of z at the end of the following program?

int value(int *x) {
  static int count;
  while(*x) {
  count = count + (*x & 1);
  *x>> =1;
   }
return count;
}
main( ) {
int a[ ]={3,5,6,4};
int y = 0 ,z = 0;
for(; y < sizeof(a)/sizeof(int) ; y++) {
 z = a[y] + value( &a[y]);
}
}
asked in Programming by (235 points) | 19 views
0

check this and after that if your doubt will not clear then let us know...

https://gateoverflow.in/118442/gate2017-1-55

 

Please log in or register to answer this question.

Related questions

0 votes
0 answers
2
asked Jan 11 in Programming by Ajit J (423 points) | 55 views
+1 vote
1 answer
3
asked Jan 2 in Programming by Shadan Karim Junior (939 points) | 44 views
0 votes
1 answer
4
asked Jan 2 in Programming by Shadan Karim Junior (939 points) | 28 views
0 votes
0 answers
5
asked Dec 30, 2018 in Programming by Shadan Karim Junior (939 points) | 48 views
0 votes
1 answer
6
asked Dec 30, 2018 in Programming by Shadan Karim Junior (939 points) | 63 views
0 votes
0 answers
7
asked Dec 30, 2018 in Programming by Shadan Karim Junior (939 points) | 100 views


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

47,080 questions
51,333 answers
177,708 comments
66,675 users