How does the data types after constant work in C?

Asked

Viewed 79 times

1

I’m reading some codes and came across the following code

#define foo unsigned int
#define i typedef

i know how this unsigned and Signed, typedef etc works, but I’m not getting to understand how this works in constant.

1 answer

4


This example shown in the question does not serve any useful purpose other than to demonstrate the directive #define.

The result of this is this:

#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 does not serve any useful purpose, only to demonstrate the directive #define. Obviously, the directive #define is very useful and appears in the C language libraries themselves.

  • our face is that =D obg. but your example serves for useful things yes, an ex and that libc uses it that way you showed :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.