Skip to content
Snippets Groups Projects
Commit 1a088a4b authored by Bruce Cowan's avatar Bruce Cowan :airplane:
Browse files

Get rid of non-library using 'add'

parent 34080b02
No related branches found
No related tags found
No related merge requests found
/* Adds up 2 integers, not the most exciting thing in the world */
#include <stdio.h>
#include "utils.h"
int
main (int argc, char **argv)
main (int argc,
char **argv)
{
int a, b;
if (argc != 3)
{
printf ("Please input an integer value: ");
scanf ("%d", &a);
printf ("Please input an integer value: ");
scanf ("%d", &b);
}
else
{
sscanf (argv[1], "%d", &a);
sscanf (argv[2], "%d", &b);
}
printf ("%d + %d = %d\n", a, b, a + b);
return 0;
int *vals = get_ints (argc, argv, 2, "Please input an integer value");
printf ("%d + %d = %d\n", vals[0], vals[1], vals[0] + vals[1]);
return 0;
}
#include <stdio.h>
#include "utils.h"
int
main (int argc,
char **argv)
{
int *vals = get_ints (argc, argv, 2, "Please input an integer value");
printf ("%d + %d = %d\n", vals[0], vals[1], vals[0] + vals[1]);
return 0;
}
executable('add', 'add.c')
executable('add2', 'add2.c', dependencies: utils_dep)
executable('add', 'add.c', dependencies: utils_dep)
executable('angle', 'angle.c', dependencies: libm)
executable('array-length', 'array-length.c', dependencies: types_dep)
executable('binary', 'binary.c')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment