Hello,
I am trying to divide the following code on three modules. I am sure I did everything correctly, however I got an error. I was wondering if there is something specific about this code that I did not take into consideration. Thank you.
I am trying to divide the following code on three modules. I am sure I did everything correctly, however I got an error. I was wondering if there is something specific about this code that I did not take into consideration. Thank you.
Code:
#include<stdio.h>
void function1(void);
void function2(char *str);
void function3(void);
void print_string(char *str);
int num;
int main (void)
{
num = 3;
function1();
print_string("DONE\n");
return 0;
}
void function1()
{
char phrase[] = "The string passed from function 1";
print_string("In function 1");
function2(phrase);
}
void function2(char *str)
print_string("In function 2");
printf("Printing -- %s\n", str);
function3();
}
void function3()
{
print_string("In function 3\n");
printf("num cubed = %i\n", num*num*num);
}
void print_string(char *str)
{
printf("%s\n",str);
}
Comment