online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include "util.h" #include "headerImpl.h" int main() { unsigned char uid[] = {0x00, 0x12, 0x00, 0x00, 0x34, 0x00, 0x59, 0xAF}; long long uidNbr = fromBigEndin<long long>(uid); std::cout<<uidNbr; return 0; }
#pragma once #include <cstdint> template <class T> T fromBigEndin(uint8_t *buf);
#pragma once #include "util.h" #include <cstring> void handleOpenSession(uint8_t *data) { uint8_t *uid = (uint8_t *)malloc(8); memcpy(uid, data + 1, 8); int64_t uidNbr = fromBigEndin<int64_t>(uid); }
#include "util.h" template<class T> T fromBigEndin(uint8_t *buf) { T number = 0; uint8_t nBytes = sizeof(T); uint8_t i; for (i = 0; i < nBytes; i += 1) { number += buf[i] << (16 * (nBytes - i - 1)); } return number; } //no angle brackets used here template int64_t fromBigEndin<int64_t>(uint8_t *buf); template long long fromBigEndin<long long>(unsigned char *buf);

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