First, see this example (I made this up for the sake of example, it\'s not a real program):
whatever.h
#ifndef WHATEVER_H
#define WHATEVER_H
void fi
Whenever you use different, incompatible types for the same variable in different compilation units (as you have done here), you get undefined behavior. That means it probably won't work and you may not get any error or warning messages about it.
WHY this happens (and why the spec says this is undefined) is due to the way most linkers work. Most linkers don't understand anything about types; they only understand names and memory. So as far as the linker is concerned, a variable is just a block of memory starting at some address. In your (original) program main.c
defines names
as referring to the start of a block of memory big enough to hold 10 pointers (probably 40 or 80 bytes, depending on whether this is a 32-bit or 64-bit system), all of which are NULL. whaterver.c
, on the other hand, assumes that names
refers to a block of memory big enough to hold ONE pointer, and that pointer points at an array of 10 pointers.