Question: Consider the following tiny program in C: void hello() { printf(Hello, world ); } int main() { hello(); } (a) Split the program into two

Consider the following tiny program in C:
void hello() {
        printf("Hello, world\n");
}
int main() {
        hello();
}

(a) Split the program into two separately compiled files, tiny.c and hello.c. Be sure to create a header file hello.h and include it correctly in tiny.c.

(b) Reconsider the program as C++ code. Put the hello function in a separate namespace, and include an appropriate using declaration in tiny.c.

(c) Rewrite the program in Java, with main and hello in separate packages.

Step by Step Solution

3.45 Rating (171 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a File tinyc b File tinycc c F... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Language Pragmatics Questions!