Hi i\'m really glad to know this site to ask question. I have a problem that i made an array. And then i want to check matching values in the array. For example,
use something like:
int matchCount = 0;
for(int i = 0;i < (sizeof(array)/sizeof(int)); i++)
{
for( int j=0; j<(sizeof(array)/sizeof(int)); j++)
{
if( i != j ) // skip when both indexes point to same location
{
if( array[i] == array[j] )
{
matchCount++;
}
}
}
}
The above is for an array of integers. very similar code for arrays of other sized types
will count matches twice, so divide final matchCount by 2