The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
You have completed the code for the automation of the required tasks; the final step is to submit the script to the team for use. After you have incorporated any appropriate feedback into your project, one last requirement needs to be addressed.
Next, you have been asked by different users to explain how to compile a program in a UNIX environment.
Finally, take the following C program (save it as "power2.c"), and create it as a file in your UNIX environment:
/* power2.c -- Print out powers of 2: 1, 2, 4, 8, .. up to 2^N */
#include <stdio.h>Â
#define N 16int main(void) {
int n; /* The current exponent */
int val = 1; /* The current power of 2 */
printf("/t n /t 2^n/n");
printf("/t================/n");
for (n=0; n<=N; n++) {
printf("/t%3d /t %6d/n", n, val);
val = 2*val;
}
return 0;
}
/* It prints out :
n 2^n
===============
0 1
1 2
2 4
3 8
4 16
5 32
6 64
7 128
8 256
9 512
10 1024
11 2048
12 4096
13 8196
14 16384
15 32768
16 65536
*/
(College of Science and Technology, n.d.)
Describe the behavior when you compile the program, with no options. What is the command that you would use to compile the code and create the executable "power2"?
Finally, compare and contrast the usage of a compiled and interpreted program.
Reference
College of Science and Technology. (n.d.). Retrieved from http://www.cis.temple.edu/~ingargio/cis71/code/power2.c
Â
Unix Systems ProgrammingUNIT 4 IP
Attachments: