Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * File: main.c
- * Author: Gerardo Cicalese
- *
- * Created on 16 settembre 2019, 15.48
- */
- #include <stdio.h>
- #include <stdlib.h>
- #define TRUE 1
- #define FALSE 0
- int search_vex(int * vex, int n, int a){
- if(n<2)
- if( *vex == a && n == 1 )
- return TRUE;
- else
- return FALSE;
- else
- if( (*vex) == a )
- return TRUE;
- else
- return search_vex(vex+1, n-1, a);
- }
- int main(void){
- int elem, vex[]={63, 15, 42, 63, 92, 34, 77, 23, 78, 37, 26, 7, 79, 85, 82, 19, 89, 10, 64};
- size_t len=sizeof(vex)/sizeof(vex[0]);
- scanf("%d", &elem);
- printf("%d is %s\n", elem, (TRUE==search_vex(vex, len, elem))?("found"):("not found") );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement