Informations

Auteur(s) Olivier Martin
Date limite Pas de date limite
Limite de soumission Pas de limite
Étiquettes de catégories Level 1, S1

Etiquettes

Se connecter

[S1] Through the array

In C, an array is a set of variables sharing the same data type : int array[3] = {42, 1337, 0};.

An item of an array can be retrieved through its index. For example array[1] gives the second element of the array (here 1337).


Find the index

Write the body of the function tab_find :

/* tab_find

@tab : an array of int
@len : the number of int in tab
@elem : the elem looked for
@return : return the index at which elem is found, else returns -1 if not found. */
int tab_find(int tab[], int len, int elem)