Con un ciclo for esamini tutti i valori

codice:
for(i=0; i<DIM; i++)
    if(S[i]==0)
        ....