M
mdh
I have asked a few questions about Macros...and think what I have been
missing ...and which all who have replied clearly understand...is that
this is a Pre-processor action.
Hopefully the above is true.
So, could someone look at this code, and help me understand why I get
this error.
#include <stdio.h>
#define get_char() getc(stdin)
#define put_char(x) putc(x, stdout)
int main (int argc, const char * argv[]) {
int c;
while ( (c = get_char) != EOF) /* error: 'get_char' undeclared
(first use in this function) */
put_char(c);
return 0;
}
I **thought** what would happen is that get_char would be replaced by
"getc(stdin)".
Thanks
missing ...and which all who have replied clearly understand...is that
this is a Pre-processor action.
Hopefully the above is true.
So, could someone look at this code, and help me understand why I get
this error.
#include <stdio.h>
#define get_char() getc(stdin)
#define put_char(x) putc(x, stdout)
int main (int argc, const char * argv[]) {
int c;
while ( (c = get_char) != EOF) /* error: 'get_char' undeclared
(first use in this function) */
put_char(c);
return 0;
}
I **thought** what would happen is that get_char would be replaced by
"getc(stdin)".
Thanks