online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C Compiler. Code, Compile, Run and Debug C program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #define BUFFER_SIZE 1 #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <stdarg.h> #include <fcntl.h> #include <string.h> int get_start_idx(const char *haystack, const char *needle) { int i = 0; int j = 0; while (haystack[i] != '\n' && haystack[i] != '\0') { while (haystack[i + j] == needle[j] && haystack[i + j] != '\n' && haystack[i + j] != '\0' && needle[j] != '\0') j++; if (needle[j] == '\0') return (i); j = 0; i++; } return (-1); } int main(int argc, char **argv) { char **all_string = (char **)malloc(1024); char **result = (char **)malloc(1024); char *line; int i = 0; all_string[0] = "***********************************************"; all_string[1] = "2303.1d shift started by : ABCD/EFGH/WWWW/ACXX 16/JAN/2023 09:00*"; all_string[2] = "****************************************"; all_string[3] = ""; all_string[4] = "1004 install and connect DOUGHTNUT"; all_string[5] = "IDONEI CONNECT DOUGHTNUT"; all_string[6] = "+4eye check : ABCD/LLLL"; all_string[7] = ""; all_string[8] = "++++++++++++++++++++++"; all_string[9] = "2303.1d shift ended by : ABCD/EFGH/WWWW/ACXX 16/JAN/2023 09:00*"; all_string[10] = "++++++++++++++++++++++"; all_string[11] = NULL; i = 0; int j = 0; int k = 0; while (all_string[i]) { if (get_start_idx(all_string[i], "shift started by") != -1) { result[k++] = all_string[i]; while (all_string[i] && get_start_idx(all_string[i], "shift ended by") == -1) { if (get_start_idx(all_string[i], "4eye check") != -1) { j = i; while (j >= 0) { if (all_string[j][0] >= 48 && all_string[j][0] <= 57) { result[k++] = all_string[j]; break; } j--; } result[k++] = all_string[i]; j = 0; } i++; } } i++; } result[k] = NULL; k = 0; while (result[k]) { printf("%s\n", result[k]); k++; } 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