Home /
Expert Answers /
Computer Science /
1-given-the-following-c-code-design-a-c-program-1-assigning-123-to-a-4-using-only-the-point-pa305
(Solved):
1. Given the following C code, design a C program - (1) assigning 123 to a[4] using only the point ...
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. int a[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.