You probably want something like this:
int nbtrues = 0;
for (int i = 0; i < NBOFROWS; i++)
{
if (row[i] == true)
nbtrues++;
}
double probability = (double)nbtrues / NBOFWORDS;
We can’t tell you much more as you didn’t show under which form your data is stored. Is your data set in a text file?
2
solved Writing C function to determine probability of 0 or 1 occurrence from a Data Array [closed]