Solved

# Binary to decimal program question...

Posted on 2003-10-25

I'm working on a program to convert decimal to binary but I don't understand so well the part under the main and why an error occurs in the line for(res=7;;) could anyone explain me this? Please, thanks.

This is the program:

#include <stdio.h>

#include <conio.h>

binary(int num, int arr[8])

{

int base=2, temp, i=7;

num=10;

while(base>=num)

{

temp=num/base;

digit=num%base;

num=temp;

arr[i]=digit;

i--;

}

arr[i]=num;

}

main()

{

int res[8];

binary(10,res);

for(res=7;;);

printf("%d",res);

getch();

}