Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
mod 4
#include <stdio.h> #include <stdlib.h> int compara(const void *dato, const void *clave) { int *ptrDato = (int *) dato; int *ptrClave = (int *) clave; return (*ptrDato) - (*ptrClave); } int main(void) { int vector[6] = {10,20,30,40,50,60}; int clave = 20; int *ptr = (int *) bsearch(&clave, vector, 6, sizeof(int), compara); int posicion; if (ptr == NULL) printf("%d NO ESTA EN VECTOR ",clave); else { printf("%p\n",ptr); printf("%p\n",vector); posicion = ptr - vector; printf("%d ESTA EN VECTOR en posicion %d",clave,posicion); } return 0; }
run
|
edit
|
history
|
help
0
ele709 lab 3.2
MATRICES TRIANGULARES
array and its sum
iplk
thermal_containers
C pattern Rhombus
Hello
B_141125_Repetidos
Euclides MIRAR
14th Dec Project1 v0.5