Run Code
|
API
|
Code Wall
|
Users
|
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
Please
log in
to post a comment.
CpointfunProd
Project 5 v0.1
1.5 No. of Processors
14th Dec Project1 v0.5
Project 3 Part 1 v1.1
PRÁCTICA DE QUICKSORT
Is const really const?
Stub Program for Problem 5 HW 2
array poi
Avance de guia 4- Pregunta 1
Please log in to post a comment.