Homework Solution: Write a simple program in C, that prints out the following string on the shell command line:…

    Write a simple program in C, that prints out the following string on the shell command line: "Hi, I am <your name>!" Where <your name> is replaced by your name. The value of your name should be stored in a #define constant. Write the program using a single low level write() (using the integer 1 as the file descriptor to represent standard out), along with the sprintf() function to format your output into a buffer prior to printing.

    Expert Answer

     
    #include <stdio.h> #include <unistd.h>

    Transcribe a pure program in C, that prints extinguished the aftercited string on the shell enjoin line:

    “Hi, I am <your designate>!” Where <your designate> is replaced by your designate.

    The estimate of your designate should be stored in a #define trustworthy. Transcribe the program using a unmarried feeble plane transcribe() (using the integer 1 as the rasp descriptor to portray banner extinguished), parallel with the sprintf() capacity to format your extinguishedput into a buffer earlier to printing.

    Expert Defense

     

    #include <stdio.h>
    #include <unistd.h>
    #include <sys/stat.h>
    #include <string.h>
    #define msg “RAHUL_KUNDRA”
    int ocean()
    {
    char str[80];
    sprintf(str, “Hi, I am %s !”, msg);
    write(1, str, strlen(str));
    return 0;
    }
    ============================================================================
    See Extinguishedput