The binary number is stored in the character array num2and1, this value is stored here: 110000110001
I want to thrust its int variable and then convert the number to decimal, and from it already into the ASCII character, and then write the received symbol into the file
For this I use the code from the book K & R
long n; n = 0; for (i = 0; num2and1[i] >= '0' && num2and1[i] <= '9'; ++i) n = 10 * n + (num2and1[i] - '0'); printf("%d", n); But the output is -1669039695. How can you correctly transfer these characters of numbers 1 and 0 to int? And why is there no binary representation of numbers in C?
'0'to'9'clearly indicates this. - Igorint, wraps itself around the maximum value many times and results in garbage. - Igor