Jevgeni Astanovski wrote:
... Is my understanding correct, that if *fpr is static,
then it is initialized to NULL and if automatic - no?
For the C language, a variable is only initialized if you code an
initializer to the definition.
_RFILE *fp = NULL;
If fp is static, it would be set to NULL once, during activation. If it
is automatic, it would be fresh storage set to NULL every time the
function gets called.
If you don't code an initializer, it might be NULL, or it might be set
to a pointer. This is true whether it is static or automatic.
In your original code, it didn't matter how it was initialized, since
you always set it immediately. But if you make it static, you'll have
to add an initializer if you want to test it before setting it.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.