a numeric value. That is, if you have
char * pbin = "01001001";
you can pass pbin as an argument to the function and have the function return an int
value of 25.
in this example pbin == 73
25 should be == 0001 1001
You should make your assignments by yourself. Ask a question if you understand a concept not.
its question from book, and no its not mine homework
They made a mistake, I think. Can't see any way that could be 25
Language: js Code: const bin2dec = s => s.split('').map((c, i, arr) => (+(c === '1')) << (arr.length - i - 1)).reduce((a, b) => a + b, 0); console.log(bin2dec("01001001")); console.log(bin2dec("11001")); Output: 73 25
Is the above sufficiently obfuscated from plagiarism in C?
C primer sucks , use K&R
What's bad about it? And what's good about K&R?
Probably for him, yes
it explains C so simple that even a toddler can learn to code
Does it work though?
Обсуждают сегодня