The output is error, please help :((

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
#include <cstdio>
using namespace std;

int main(){
  int T, kasus = 0;
  scanf( "%u", &T );
  while ( T-- ){
    int n, m, arr[10005], answer, a, b;
    kasus = kasus++;
    scanf( "%u %u", &n, &m);
    printf( "Kasus #%u:",kasus );
    
    for(int i=0; i < n; i++){
    scanf( "%u", &arr[i] );
    }
    for(int i=0; i < m; i++){
      answer = 0;
      scanf( "%u %u", &a, &b);
      for(int j=0; i < n; i++){
        if ( arr[j] < b && arr[j] > a ){
          answer = answer++;    
        }
      printf( "%u\n", &answer );
      }
    }
  }
  return 0;
}

Input:
2
10 3
12 8 45 6 8 10 17 20 17 19
7 20
15 20
1 100
5 2
30 50 20 50 15
20 60
50 60

Output:
Kasus #1:3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
Kasus #2:3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
3215430280
3215430280

I'm confused :(
I think that you don't want to print "&answer" but instead "answer".
Also, it might be easier to use cin, cout from iostream instead of scanf and printf
Topic archived. No new replies allowed.