Information

Author(s) Olivier Martin
Deadline Καμία προθεσμία
Submission limit No limitation
Category tags level1, s1

Ετικετές

Συνδεθείτε

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