add - #include <stdlib.h> #include...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * Simple program to add two numbers (given in as arguments). Used to * test argument passing to child processes. * * Intended for the basic system calls assignment; this should work * once execv() argument handling is implemented. */ #include <stdio.h>
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: #include &lt;stdlib.h&gt; #include &lt;err.h&gt; int main(int argc, char *argv) { int i, j; if (argc != 3) { errx(1, &quot;Usage: add num1 num2&quot;); } i = atoi(argv[1]); j = atoi(argv[2]); printf(&quot;Answer: %d\n&quot;, i+j); return 0; }...
View Full Document

Ask a homework question - tutors are online