|
#include <stdio.h>
int to_binary(int n);
void main()
{
int binary;
char str[500];
char c;
char *ch;
printf("Enter the Code : ");
scanf( "%s \n" , &str);
printf("Enter the Code : ");
scanf("%d ",&c);
while(str != NULL ) {
printf("Enter the Code : ");
scanf("%d", & *ch);
binary = to_binary(c);
printf("%d",binary);
*ch ++;
}
}
int to_binary(int *ch) {
int r;
r = *ch % 2;
if( *ch >= 2)
to_binary( *ch / 2);
putchar( '0' + r );
return 0;
}
이렇게 짜 봤는데... 에러는 없고 컴파일은 안되네요.
아.. 출력되는 2진수 값은
00000000 11111111 10010110
이런식으로 출력 되어야 하는데... 도움 부탁 드리겠습니다 ^^;
|