K
Kobu
The code below isn't compiling for me (error message: conflicting types
for 'total' - pointing to the extern declaration).
Why wouldn't this work, since the types are different, the extern
declaration obviously refers to the 'long total' in total.c? Is my
compiler wrong?
total.c
-------
long total = 30;
main.c
-------
#include <stdio.h>
#include <stdlib.h>
static int total = 20;
int main(void)
{
long temp;
extern long total;
/* rest of main */
temp = total;
printf("%d\n", temp);
system("PAUSE");
return 0;
}
for 'total' - pointing to the extern declaration).
Why wouldn't this work, since the types are different, the extern
declaration obviously refers to the 'long total' in total.c? Is my
compiler wrong?
total.c
-------
long total = 30;
main.c
-------
#include <stdio.h>
#include <stdlib.h>
static int total = 20;
int main(void)
{
long temp;
extern long total;
/* rest of main */
temp = total;
printf("%d\n", temp);
system("PAUSE");
return 0;
}