gdb-intro-kwlug/examples/points/breakwatch.c

41 lines
520 B
C
Raw Normal View History

/* points.c -- Break and watch examples. */
#include <stdio.h>
struct sttest
{
int index;
char name[15];
int value;
};
int
test_func (int n)
{
int r;
r = n + 10;
r += 20;
return r;
}
int
main (int argc, char **argv)
{
int a, b, i;
struct sttest example_struct[10];
a = 5;
b = test_func (a) / 10;
for (i = 0; i < 10; i++)
{
example_struct[i].index = i;
sprintf (example_struct[i].name, "element %d", i);
example_struct[i].value = test_func (i);
}
return 0;
}