abnormal behaviour upon uploading this sketch

I wanted to contol a 7 segment display using cd4511. For this I wrote this code:

byte segarray[10][4]={ // martix showing cd4511 truth table
   { 0,0,0,0}, //0
   {0,0,0,1}, //1
   {0,0,1,0}, // 2
   {0,0,1,1}, // 3
   {0,1,0,0}, //4
   {0,1,0,1}, //5
   {0,1,1,0}, //6
   {0,1,1,0}, //7
   {1,0,0,0}, //8 
   {1,0,0,1} //9
} ;
void setup(){
int i;
for(i==0; i<3; ++i) { // pin0 = icpin6 pin1 = icpin2 pin2 = icpin1 pin3 = icpin7
pinMode(i, OUTPUT);
}
}
void loop(){
int digit = 2;
disp(digit);
}
void disp(byte digit){
  int pin;
  for(pin==0;pin<3;++pin){
  for (byte segCount = 0; segCount < 4; ++segCount) {
    digitalWrite(pin, segarray[digit][segCount]);
    ++pin;
  }
  }
}

The compiler did not display any error messages it compiled the code but when i uploaded the code the on-board led connected to pin 13 lighted up and when I pressed the reset button the led started blinking. I don’t understand why the arduino is doing this.

Hard to say without all the code, but it sounds like you're not uploading the program, and it's still running the Blink program from when you were testing?

Please post more code if you're sure the programmer is working correctly.

Even when I am uploading blink example the arduino is behaving in the same way. Here is an error message i get

Binary sketch size: 1,072 bytes (of a 30,720 byte maximum)
avrdude: stk500_recv(): programmer is not responding

Btw
I using ubuntu 12.10

glamis: Even when I am uploading blink example the arduino is behaving in the same way. Here is an error message i get

Binary sketch size: 1,072 bytes (of a 30,720 byte maximum)
avrdude: stk500_recv(): programmer is not responding

I think some Arduinos are pre-loaded with Blink. It's kinda the Hello World of microcontrollers.

The error message is telling you the computer and the Arduino aren't talking, so your program isn't being uploaded and definitely isn't running. The most common cause of that is selecting the wrong port or baud rate.

This == should be a =

for(pin==0;pin<3;++pin){

In effect you’re leaving pin uninitialised, since it is an automatic variable which means the compiler won’t initialise it for you. I don’t know whether that’s the only problem, but fix the ones you find and then see what’s left.

glamis: The compiler did not display any error messages it compiled the code but when i uploaded the code the on-board led connected to pin 13 lighted up and when I pressed the reset button the led started blinking.

Did you actually click on the "Upload" button - circle with right arrow - or just the "Verify" (tick in circle) button? Did you get the "Binary sketch size: nnnn bytes (of a 30720 byte maximum)" message in the message window and did you get a "Done Uploading" status in the blue bar above it?

Have you checked to which port you are sending in "Tools ==> Serial Port" and the correct device in "Tools ==> Board"?

You will also need to explain what Arduino you are actually using and any associated equipment.

Paul__B: Have you checked to which port you are sending in "Tools ==> Serial Port" and the correct device in "Tools ==> Board"?

You will also need to explain what Arduino you are actually using and any associated equipment.

Yeah this - everything else is immaterial until we get your computer talking to the Arduino. Your error message above shows that, yes, you did the correct procedure to upload, but your programmer device is not working. Don't even worry about code until you get that fixed. Then, upload one of the example programs to check that your Arduino is working right and accepting the program - if the behavior doesn't change or if you get different error messages, then we still have a problem. Don't even worry about your own code until you can get one of the examples running and you can upload whenever you want - debugging is gonna be hell if you're having connection issues. So, get that sorted out before you try anything more confusing than the example codes.

yes I did compile the code and it did show me the size of the sketch. As for the arduino board I'm using a freeduino usb 1.1 that uses a usb to serial converter ic (ftdi). It used to work fine before. Now when i'm uploading sample codes the pin 13 goes high (or the led attached to this pin starts blinking or dimly lits up ).

glamis: yes I did compile the code and it did show me the size of the sketch.

And the other steps in the process about which I asked?

glamis: yes I did compile the code and it did show me the size of the sketch. As for the arduino board I'm using a freeduino usb 1.1 that uses a usb to serial converter ic (ftdi). It used to work fine before. Now when i'm uploading sample codes the pin 13 goes high (or the led attached to this pin starts blinking or dimly lits up ).

Yeah ok, but is it still saying this?

avrdude: stk500_recv(): programmer is not responding

That means you didn't program the board. Sometimes you have to reset it manually at the perfect moment, but like I said, usually that message means you picked the wrong port or something. Nothing else matters if you're still seeing that message. When it works right, it will say "Done uploading." in the info bar above the window where it gives you those messages. Do you see that?

Do you have current-limiting resistors in your circuit?

Are you able to upload a simple empty or blink sketch with nothing connected to the board?