Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Given the following C code, design a C program - (1) assigning 123 to a[4] using only the pointer q, (2) printing a [4]
1. Given the following C code, design a C program - (1) assigning 123 to a[4] using only the pointer q, (2) printing a [4] using only the pointer p. Do not modify the following C code and do not use the array a. inta[10],*p,*q;p=&a[2];q=p+1 Test it and take a screenshot showing your C code. (4 points) 2. Given the following C code, design a C program - (1) moving a file pointer using fseek (2) saving this sentence "This is Your Name" to sample.txt using fputs with fp. Do not modify the following C code. int main ()\{ FILE *fp; fp = fopen("sample.txt","w+"); fputs("This is CSIT315", fp); return(0); Save your C program to lab5.c, and take a screenshot showing your C code and its output. (4 points) 3. Design a shell program (called "auto_compile_run.sh") meeting the following requirements ( 2 points) a. Two file names are given as two arguments of auto_compile_run.sh. For example, auto_compile_run.sh lab5.c lab5 The first argument (lab5.c) is a C file, and the second argument is its executable file (lab5). b. If there is no argument, echo "No Input Files". c. In auto_compile_run.sh, the C program must be compiled and run
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started