7-segment display works, but some of the LED segments are dimmed

Hello all,

I'm trying to program a 7-segment display. It works, but some of the LED segments are dimmed which makes reading the display a bit difficult. I'd appreciate any feedback. Here's my code:

int A = 2;
int B = 3;
int C = 4;
int D = 5;
int E = 6;
int F = 7;
int G = 8;
int L3 = 13;
int L2 = 12;
int L1 = 9;
int i;
int j;

int displayMatrix[10][7] = {
  {0, 0, 0, 0, 0, 0, 1},
  {1, 0, 0, 1, 1, 1, 1},
  {0, 0, 1, 0, 0, 1, 0},
  {0, 0, 0, 0, 1, 1, 0},
  {1, 0, 0, 1, 1, 0, 0},
  {0, 1, 0, 0, 1, 0, 0},
  {0, 1, 0, 0, 0, 0, 0},
  {0, 0, 0, 1, 1, 1, 1},
  {0, 0, 0, 0, 0, 0, 0},
  {0, 0, 0, 0, 1, 0, 0}
};


//the hard reset:
void hardReset () {
  digitalWrite(L1, LOW);
  digitalWrite(L2, LOW);
  digitalWrite(L3, LOW);
  digitalWrite(A, HIGH);
  digitalWrite(B, HIGH);
  digitalWrite(C, HIGH);
  digitalWrite(D, HIGH);
  digitalWrite(E, HIGH);
  digitalWrite(F, HIGH);
  digitalWrite(G, HIGH);

}

void sevenDesplay(int x) {
  //the "separator" part of the function
  int hundreds = floor(x / 100);
  int tens = floor((x - hundreds * 100) / 10);
  int ones = x - hundreds * 100 - tens * 10;
  

  //now the "display" part of the function
  for (i = 0; i <= 9; i++) {
    if (i == hundreds) {
      hardReset ();
      digitalWrite(L3, HIGH);
      digitalWrite(L2, LOW);
      digitalWrite(L1, LOW);
      for (j = 0; j <= 6; j++) {
        digitalWrite(2 + j, displayMatrix[i][j]);
      };
    }
  }
  for (i = 0; i <= 9; i++) {
    if (i == tens) {
      hardReset ();
      digitalWrite(L3, LOW);
      digitalWrite(L2, HIGH);
      digitalWrite(L1, LOW);
      for (j = 0; j <= 6; j++) {
        digitalWrite(2 + j, displayMatrix[i][j]);
      };
    }
  }
  for (i = 0; i <= 9; i++) {
    if (i == ones) {
      hardReset ();
      digitalWrite(L3, LOW);
      digitalWrite(L2, LOW);
      digitalWrite(L1, HIGH);
      for (j = 0; j <= 6; j++) {
        digitalWrite(2 + j, displayMatrix[i][j]);
      };
    }
  }
}











void setup() {
  // put your setup code here, to run once:

  pinMode(L1, OUTPUT);
  pinMode(L2, OUTPUT);
  pinMode(L3, OUTPUT);
  pinMode(A, OUTPUT);
  pinMode(B, OUTPUT);
  pinMode(C, OUTPUT);
  pinMode(D, OUTPUT);
  pinMode(E, OUTPUT);
  pinMode(F, OUTPUT);
  pinMode(G, OUTPUT);


}

void loop() {
  // put your main code here, to run repeatedly:


  sevenDesplay(46);






}

How are they wired? Current limit resistor per segment?

No resistor. Why is that necessary?

Resistor keeps the IO pin from burning out with excess current drive.