I am trying to improve a program I have, but there is one thing I cannot figure out to do... so, trying to make this short, this is what I'd like to accomplish:

Is there a way for C to count how many variables are equal to a particular value?

For example, say I have integers a,b,c,d and assign them like this:

a=4;

b=2;

c=4;

d=4;

Is there a way to save the amount of variables that equal a? (which would be 2.. or 3 if you count a).

I just really want to save a single numerical value that tells how many variables I have equal to something.