* config/sh/tm-sh.h (BELIEVE_PCC_PROMOTION): Define, so that
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.hp / average.c
CommitLineData
8e260d52
DT
1/* This is a sample program for the HP WDB debugger. */
2
3#include <stdio.h>
4
5#define num 10
6
7static int my_list[num] = {3,4,2,0,2,1,8,3,6,7};
8
9#ifdef __STDC__
10void print_average(int list[], int low, int high)
11#else
12void print_average(list, low, high)
13int list[], low, high;
14#endif
15 {
16 int total, num_elements, average;
17 total = sum(list, low, high);
18 num_elements = high - low; /* note this is an off-by-one bug */
19
20 average = total / num_elements;
21 printf("%10.d\n", average);
22 }
23
24#ifdef __STDC__
25int main(void)
26#else
27main ()
28#endif
29{
30 char c;
31 int first = 0;
32 int last = num-1;
33
34 /* Try two test cases. */
35 print_average (my_list, first, last);
36 print_average (my_list, first, last - 3);
37foo:
38 exit(0);
39}
This page took 0.033797 seconds and 4 git commands to generate.