online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> #include <stdlib.h> char *decimal_to_binary(int); char *decimal_to_binary(int dn) { int i, j, temp; char *ptr; temp = 0; ptr = (char*)malloc(32+1); for (i = 31 ; i >= 0 ; i--) { j = dn >> i; if (j & 1) *(ptr+temp) = 1 + '0'; else *(ptr+temp) = 0 + '0'; temp++; } *(ptr+temp) = '\0'; return ptr; } int main() { int dn; char *ptr; printf("Input a decimal number: "); scanf("%d", &dn); ptr = decimal_to_binary(dn); printf("Binary number equivalent to said decimal number is: %s", ptr); free(ptr); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue