online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <stdio.h> int linear_search_function(int [], int, int); void main() { int arr[10], Element, i, size, position = 0; //ask the user for the size of the the array printf("Enter size of the array:\n"); scanf("%d", &size); // ask user to provide values of array printf("Enter any %d integer values:",size); //save the value in array for (i = 0; i < size; i++) { scanf("%d", &arr[i]); } printf("Enter the element to search:\n"); scanf("%d", &Element); position = linear_search_function(arr, size, Element); //if position is -1 after looping all the elements //then element is not found if (position == -1) { printf("%d isn't present in the array.\n", Element); } else { printf("%d is present at position %d in the array.\n", Element, position); } } int linear_search_function(int arr[], int size, int Element) { int i; for (i = 0; i < size; i++) { if (arr[i] == Element) { return i; } } return -1; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text



Program is not being debugged. Click "Debug" button to start program in debug mode.