Información

Autor(es) Olivier Martin
Fecha de entrega Sin fecha de envío
Tiempo límite de envío Sin límite de envío
Etiquetas de categoría level1, s1

Etiquetas

Inicia sesión

[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)