online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <stdint.h> #include <stdio.h> uint8_t swap_half(uint8_t val) { return (val << 4) | (val >> 4); } uint32_t swap(uint32_t data) { uint8_t b1 = ((data >> 16) & 0xFF00) >> 8; b1 = swap_half(b1); uint8_t b2 = ((data >> 16) & 0xFF); b2 = swap_half(b2); return (data << 16) | (b1 & 0x000000FF) << 8 | (b2 & 0x000000FF); } int main() { uint32_t data = 0x1baacc8b; // need 0xcc8bb1aa printf("\ndata before swapping : %X", data); data = swap(data); printf("\ndata after swapping : %X", data); 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