Hi,
I Have 2 question2 regarding this code:
1 - int_to_bin(c); // Why &c not working here ?
2 - str[i] = (num&1)?'1':'0'; // What this expression do ? ?'1':'0'
thanks
Code:#include<stdio.h> void int_to_bin(int num); int main() { int c; printf("nEnter a number :"); scanf("%d",&c); int_to_bin(c); // Why &c not working here ? return 0; } void int_to_bin(int num) { char str[9] = {0}; int i; for (i=7; i>=0; i--) { str[i] = (num&1)?'1':'0'; // What this expression do ? ?'1':'0' num >>= 1; }