online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> #include <sys/mman.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> int main() { int fd = open("main.c", O_RDONLY); struct stat sb; fstat(fd, &sb); char *addr = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0); close(fd); printf("Mapped %zd bytes of main.c into memory at %p\n", sb.st_size, addr); int lines = 0; for (int i = 0; i < sb.st_size; i++) { if (addr[i] == '\n') { lines++; } } printf("There are %d lines in main.c\n", lines); munmap(addr, sb.st_size); 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