extern data and static diffenece since static is used for keeping the value after existing function, extern use the value in other module. are they the same?
If you want a variable that can be accessed in different modules, you have to declare it globally and not in a function.
I think the "they are the same" comes from the fact that both do not overlay. Otherwise, of course, they are quite different. Erik
"both do not overlay" Hmm... not really. That deduction is not logical, Captain: It's not the 'extern' that affects whether something can overlay or not - the thing has to be global before it can be accessed via 'extern', and it's the fact of being global that makes it non-overlayable.
sorry, I was a bit off, read my post as to "static" and "global". :( Of course, if something is "extern" it must be global, so thus "extern" makes sense. I do agree that a variable can be global without being used extern, but why the heck would anyone do that? Erik
"I do agree that a variable can be global without being used extern, but why the heck would anyone do that?" In 'C', everything defined at file scope is automatically "Public" - whether or not any other module actually references it. You use 'static' with file-scope objects if you want to prevent them from being "Public"
View all questions in Keil forum