hw3-solutions

Your home directory on those servers is your u drive

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ess/#Linux- Remote- Access for remote access instructions. See http://www.washington.edu/computing/unix/unixqr.html for commonly used UNIX commands. You may create your program using your favorite editor and then copy it into your U: drive. Your home directory on those servers is your U: drive. To build a program, assuming the name of the program file is myprogram.c: gcc –o myprogram myprogram.c To test run the program: ./myprogram Question 1: Function and Pointer (10 pts) The following function is intended to swap the values of two variables: // swap the contents of x and y void swap (int x, int y) { int tmp; } tmp = x; x = y; y = tmp; // example of using swap() void call_swap() { Name: Lab Section: int a, b; … swap (a, b); … } The function does not work as intended. Explain Why. Then revise the code, including both swap and call_swap functions. Test your code, and then cut and paste it in the space below. C function is pass- by- value, that means swap...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online