I'm reading some code and I came across the following code
#define foo unsigned int
#define i typedef
I know how this unsigned and signed, typedef etc works, but I can not figure out how this works on the constant.
I'm reading some code and I came across the following code
#define foo unsigned int
#define i typedef
I know how this unsigned and signed, typedef etc works, but I can not figure out how this works on the constant.
This example shown in the question is not useful at all, except to demonstrate the #define
directive.
The result of this is as follows:
#define foo unsigned int
#define i typedef
// bla bla bla
foo x; // literalmente: "unsigned int x;"
i int y; // literalmente: "typedef int y;"
y z; // literalmente: "int z;"
As I said above, this example is not useful at all, just to demonstrate the #define
directive. Obviously, the #define
directive is very useful and appears a lot in the C language libraries themselves.