How do I print from one function?
Code:
/*
This is a simplified outline of my program as it treats the display of
titles and messages: messages are printed from individual modules. I want
to change the program by printing out all titles and messages from a single
module, calling this function as and when needed during the execution of the
program.
I have difficulty in grasping how this might be done: I want to call this
single print function from different modules and I want to display only one
particular message at each call to the function.
I have two questions:
1.How would I do this by passing a string (character array: char[]) as an
argument?
2.How would I use a pointer to do this?
*/
main()
{
one();
two();
three();
}
one()
{
printf("\nmessage 1");
}
two()
{
printf("\nmessage 2");
}
three()
{
printf("\nmessage 3");
}