This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
如题
你的这个变量是在哪里定义的?
我在.c文件中刚开始就定义,作用域不单单是在一个函数中,然后想在中断函数中引用。
是不是在main函数之前定义的全局变量,全局变量应该没问题的。
您看看我的定义
是没有定义,只是声明了一下,没有赋初值。
您看看 我赋初值了,还是说我未定义
中断函数是不是在同一个源文件中,能不能把代码都贴出来看一下。
您看看
你看看这个代码
中断函数和这些变量的定义是不是在同一个源文件中?如果没在一起的话,在中断源文件中还需要加extern再声明一下。
加了extern还是说我未定义(undefine)这个变量啊
比如你在主程序中定义的“unsigned int blockid=0;" ,那么在中断源文件中再用extern声明一下"extern unsigned int blockid;“.