Ignore:
Timestamp:
May 19, 2011, 4:03:04 PM (10 years ago)
Author:
ayache
Message:

32 and 16 bits operations support in D2.2/8051

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/tests/review1/search.c

    r642 r818  
    1 // #include<stdio.h>
     1#define SIZE 5
     2#define NB_FINDS 2
    23
    3 #define SIZE 5
     4// Searching for the values below
     5int to_find[NB_FINDS] = {57, -1};
    46
    5 // Searching for the value below
    6 #define TO_FIND 57
    7 
    8 char search (char tab[], char size, char to_find) {
    9   char low = 0, high = size-1, i;
     7int search (int tab[], int size, int to_find) {
     8  int low = 0, high = size-1, i;
    109
    1110  while (high >= low) {
     
    2019
    2120int main () {
    22   char tab[SIZE] = {0, 18, 23, 57, 120};
    23   char res = search(tab, SIZE, TO_FIND);
     21  int tab[SIZE] = {-30, -18, 23, 57, 120};
     22  int res;
     23  int i;
    2424
    25   //  printf("%d\n", res);
    26   return res;
     25  for (i = 0 ; i < NB_FINDS ; i++)
     26    println(search(tab, SIZE, to_find[i]));
     27
     28  return 0;
    2729}
Note: See TracChangeset for help on using the changeset viewer.