Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Linear Searching
#include <stdio.h> #include <stdlib.h> int main(void) { int *a, n, i, value, found = 0; printf("How many values do you want to store ? : "); scanf("%d", &n); a = (int *) malloc(n * sizeof(int)); printf("Enter %d values to store : ", n); for (i = 0; i < n; i++) { scanf("%d", &a[i]); } printf("Enter the value to search : "); scanf("%d", &value); for (i = 0; i < n; i++) { if (a[i] == value) { found = 1; break; } } if (found == 1) { printf("%d was found. a[%d] = %d\n", value, i, value); } else { printf("%d was not found\n", value); } return 0; }
run
|
edit
|
history
|
help
1
32bit
Program 1 - 2D array and memory pointers
Finding the second largets value v0.5
150108_RecursividadFibonacci
prime or not
blue saver go my marshal green
String operations in C (without using built-in methods)
C_141126_ArrayMayorMenor02
experimento con quicksort
FUNCTIONS Shape functions