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, PHP, Ruby, C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world. Gabriel Staples https://github.com/ElectricRCAircraftGuy/eRCaGuy_hello_world www.ElectricRCAircraftGuy.com 19 Nov. 2021 See: https://stackoverflow.com/q/70043572/4561887 Share link: https://onlinegdb.com/Ht7HbW4Iu *******************************************************************************/ #include <stdbool.h> #include <stdio.h> /// Get the number of elements in an array #define ARRAY_LEN(array) (sizeof(array)/sizeof(array[0])) /// Return false for -1, 0, or +1, and return true otherwise. bool is_it_right(int i) { if (i/2 == 0) { return false; } return true; } void print_array(int arr[], size_t len) { printf("["); for (size_t i = 0; i < len; i++) { printf("%i", arr[i]); if (i < len - 1) { printf(", "); } } printf("]\n"); } int main() { int arr[] = {-3, -2, -1, 0, 1, 2, 3}; int arr_filtered[ARRAY_LEN(arr)]; size_t arr_filtered_len; // Remove values -1, 0, and +1 from the array int j = 0; for (size_t i = 0; i < ARRAY_LEN(arr); i++) { if (is_it_right(arr[i])) { arr_filtered[j] = arr[i]; j++; } } arr_filtered_len = j; print_array(arr, ARRAY_LEN(arr)); print_array(arr_filtered, arr_filtered_len); 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