Im having a little trouble calling an external print function.
The external print function must take no args and must not have a return value.
The program must accept ints as input, copy the value to a global var called gM then print it using the external function until a 0 is input.
I get gM not found when i try to compile them.
I use the line cl /c main.c compolent.c to get .obj files, this is where it throws the error
and cl main.obj compolent.obj to link them.
How can i fix my globar var error?
My main source is:
CODE
#include <stdio.h>
long gM=1;
int main(void)
{
while(gM!=0)
{
printf("\nEnter a list of ints");
scanf("%ld",&gM);
myPrintFunction();
}
return(0);
}
and my external function is
CODE
void myPrintFunction()
{
printf("\nPrintFunction: %ld", gM);
}
Thanks for your help.