Function returning what seems to be an adress

caller function:
printf("%d",binaryadd(path));

function to be called:
1
2
3
4
5
6
7
8
int binaryadd (char a[8])
{
    int m,n,zerocounter;
    for (m=0;m<=7;m++)
    if (a[m]==0)
    zerocounter++;
return zerocounter;
}


zerocounter is an integer. so output should be 1 or 2 or 3. Yet when its called to print it gives out 20071939148 etc etc.


I cannot explain this
elaborate what you are doing... give me an example of what you put in and give me an example of what you want out... (three different one please...) and what the final results of a[], m, and why you even have n...
Last edited on
You didn't initialize zerocounter to 0, so it could be any value.
Thanks hamsterman!
I cant believe I never picked that up...
Thanks again
Topic archived. No new replies allowed.