How to tune Vim, use the C compiler and more about the shell
Quiz 02
Once everything is setup do the following on our server theon:
-
Create a file quiz02_hello1.c with the following content:
1 2 3 4 5
int main() { puts("hello, world!"); }
-
Compile this source file and run the generated executable hello1 as follows (it is intended that you see some warnings here)
theon$ gcc -o hello1 quiz02_hello1.c quiz02_hello1.c: In function 'main': quiz02_hello1.c:4:5: warning: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 4 | puts("hello, world!"); | ^~~~ quiz02_hello1.c:1:1: note: include '<stdio.h>' or provide a declaration of 'puts' +++ |+#include <stdio.h> 1 | int theon$ hello1 hello, world! theon$
Note that gcc produces a warning but not an error! So despite its concerns gcc actually created a executable (and correct) program.
Copy the output produced by gcc (i.e. the warning in the box above) in a file quiz02_hello1.txt.
-
Create a file quiz02_hello2.c with the following content:
1 2 3 4 5 6 7
int puts(const char*); int main() { puts("hello, world!"); }
-
Compile this source file and run the generated executable hello2 as follows
theon$ gcc -o hello2 quiz02_hello2.c theon$ hello2 hello, world! theon$
Copy the output produced by hello2 in a file quiz02_hello2.txt.
-
Submit the created files using the submit command as follows:
theon$ submit hpc quiz02 quiz02_hello1.c quiz02_hello1.txt quiz02_hello2.c quiz02_hello2.txt theon$
Not that quiz02 you only get some feedback from submit if there was a problem. So “no news” means “good news”. That's because in this submission we have no automatic tests for your submission, i.e. we accept anything.