This should let you enter a number and malloc the needed structures
int iEach;
int CPU_number;
struct CPU {
int state;
} *pcpu;
printf ( "enter number of CPU's: ");
scanf( "%d", &CPU_number);
pcpu = malloc ( sizeof (struct CPU) * CPU_number);
for ( iEach = 0; iEach < CPU_number; iEach++) {
// here are equivalent ways to access the structures
pcpu[iEach].state = 1;
(pcpu + iEach)->state = 1;
}
free ( pcpu); // remember to free memory when you are done