PORT names ans CONST in an array
The compiler is correct. PORTx aren't constant; they result in the value stored in hardware. You need to store a pointer to the port and then dereference it when appropriate.

const *char my_ports[4] = {&amp;PORTB, &amp;PORTB, &amp;PORTD, &amp;PORTA};
const char my_pins[4] = {3, 7, 1, 4};

 ...

void pin_update(void)
{
  for (k=0; k&lt;=3; k++)
  {
    if (*(my_ports[k]) &amp; my_pins[k])
    {
     // and actions here ........
    }
  }
}