I would like to explain by using following sample piece of code: char[4] ch = {'1', '2', '3', '4'}; int i = 0; n = 4; for (i = 0; i < n ; i++) { i += (ch[i] - '0') * pow(10, n-i-1); }
Now, i has converted integer value of i
#include <stdio.h> int main() { char val=250; int ans; ans= val+ !val + ~val + ++val; printf("%d",ans); return 0; }
A char can not be a +ve or -ve. last bit is signed bit in accumulator.but not useful for CHAR Whats the purpose? of doing it.
Write a program to reverse the bits of an unsigned integer ??