Homework 1 Hello World Solution

$35.00 $30.80

Description

For this assignment you will write a simple program in C that prints out the following string on the shell command line: Hello 415, I am <your name>! where <your name> is replaced by your name (you should store the value of your name in a #DEFINE’d constant).

 

You will implement this program using the POSIX API on Linux. It should use the snprintf() function to format your output into a buffer that is then passed to a single invocation of the write() system call (using the integer 1 as the file descriptor to represent standard out). Use an appropriate conversion specifier as a placeholder for <your name> in the format string passed to snprintf(). Check the Linux man pages for details on how to use POSIX system calls (including the #include directives you will need for each one). Use

 

  • to compile your program with the “-Wall” flag. The program should compile without warnings.

 

You should submit your source code file and a short writeup in pdf format that includes a description of what you did and the compilation and execution output from your program.