<SOLVED> why does a variable show a different result when sent to a function?

I am trying to learn various ways of reducing the number of lines in a sketch and want to use a function that can be called with different variables. I have been struggling with part of this sketch for a while.

//undersatanding  functions
int a[]={1,2,4,8,16};
int i;
int b = 0;
int c = 0;
int d = 0;
//int test;
void setup() {
  // put your setup code here, to run once:
Serial.begin (9600);
}
void loop() {
  // put your main code here, to run repeatedly:
  b++;
  c=(b+7);
  for (int d=0;d<5;d++){
    test (b,c,d);
  }
}
void test(int numb, int numb2, int numb3){
  for (i=0;i<5;i++) {
    Serial.print (a[i]);
    Serial.print ("  ");
  }
  Serial.print (numb);
  Serial.print ("  ");
  Serial.print (numb2);
  Serial.print ("  ");
  Serial.print (numb3);
  Serial.print ("  ");
  Serial.print (b);
  Serial.print ("  ");
  Serial.println (d);
  delay (500);
}

variable d increments in the loop function and when sent to the test function as part of 'test(b,c,d)' is replaced with numb3 which prints out as an incrementing number 0 to 4 as it should.
I get
1 2 4 8 16 1 8 0 1 0
1 2 4 8 16 1 8 1 1 0
1 2 4 8 16 1 8 2 1 0
1 2 4 8 16 1 8 3 1 0
1 2 4 8 16 1 8 4 1 0
1 2 4 8 16 2 9 0 2 0
1 2 4 8 16 2 9 1 2 0
Serial.print(b) prints the same as 'numb' but the last 'Serial.println' should just print 'd' the same as 'numb3' (the variable d, 0 to 4) but it just stays at 0, anyone know why?

int d = 0;

  for (int d=0;d<5;d++){
    test (b,c,d);

  Serial.println (d);

Which d do you think you are printing? Which d are you actually printing?

See why having global and local variables with the same name is such a bad idea? See why one letter global names are stupid?

thank you Paul, that was my problem, in building this I have been changing things and failed to notice that. I just removed the 'int' from the line ' for (int d=0;d<5;d++){' and it works now.
Thank you for the prompt reply.