The variable used
is a duplicated name. In main
the local used
is accessed. But in checkData
the global instance is used, but causes an error since you are dereferencing a NULL
pointer (static variables are initialised to 0
).
solved C – can’t access global variable within user functions