So I have some code here that I have been studying. It converts decimal numbers to binary. The code runs smoothly but what's bugging me are the variables. The code is as follows:
#include
int main()
{
long int decimalNumber, remainder, quotient;
int binaryNumber[100], i=1, j;
printf("Enter any decimal number: ");
scanf("%ld",&decimalNumber);
quotient = decimalNumber;
while (quotient!=0) {
binaryNumber[i++]= quotient % 2;
quotient = quotient / 2;
}
printf("Equivalent binary value of decimal number %d: ", decimalNumber);
for (j = i -1 ; j> 0; j--)
printf("%d",binaryNumber[j]);
return 0;
}
I really find the variables confusing. Can someone tell me what is actually happening with the variables? Especially the one with binaryNumber[100],binaryNumber[i++], binaryNumber[j], and the expression binaryNumber[i++] = quotient % 2