title: When a strong symbol and weak symbol have different data types, whose data type is chosen?
body: <p>If I have two different C files like this - </p>
  
  <p>main.c </p>
  
  <pre><code>void f(void);
  int x = 38;
  int y = 39;
  
  int main()
  {
   f();
   printf("x = %d\n", x);
   printf("y = %d\n", y);
   return 0;
  }
  </code></pre>
  
  <p>swap.c</p>
  
  <pre><code>double x;
  void f()
  {
   x = 42.0;
  }
  </code></pre>
  
  <p>My question is since int x is the stronger symbol here, shouldn't  "x"  be initialized as an int and when function f is called, x = 42.0 would simply store x with only 42. But instead x becomes 0 since a double is being written into an int.</p>
  
  <p>When the program is run, after linking both the files, we get this output</p>
  
  <p>x = 0
  y = 1078263808</p>