Hello,

I know that external variables are seen by every function in every file of the program and static variables (do they have to be declared in a function body or can they be declared outside?) are only seen by functions in the same file where they were declared.
I want to see the difference between extern and static - in my mind the first two functions should work but the 3. should not because the static variable is not visible in the add1() function as it is declared in another file.

Can someone tell me if I am right? If so what needs to happen so that my Makefile compiles. Thanks! :-)

Code:
//file computesize.c

#include <stdio.h>
#include "functionimporttest.c"


void add1(int a, int b);


void add1(int a, int b){
  printf("%s%d\n", "add function from computesize.c", a + b);
}


main() {


  add(glob, 1);
  add(static_int, 1);
  add1(static_int, 1);
}
Code:
// file functionimporttest.c
#include <stdio.h>


int glob = 3;




void add(int a, int b);


void add(int a, int b){
  static int static_int = 5;
  printf("%s%d\n", "add function from functionimporttest", a + b);
}
Code:
test: computesize.c
    $(CC) computesize.c functionimporttest.c -o testprogram -Wall