Please explain syntax rules and scope for "typedef"

Posted by unknown google user on Stack Overflow See other posts from Stack Overflow or by unknown google user
Published on 2010-03-11T18:47:03Z Indexed on 2010/03/11 18:49 UTC
Read the original article Hit count: 213

Filed under:
|

What are the rules? OTOH the simple case seems to imply the new type is the last thing on a line. Like here Uchar is the new type.

typedef unsigned char Uchar;

But a function pointer is completely different. Here the new type is pFunc:

typedef int (*pFunc) (int);

I can't think of any other examples offhand but I have come across some very confusing usages.

So are there rules or are people just suppose to know from experience that this is how it is done because they have seen it done this way before?

ALSO: What is the scope of a typedef.

Thanks to everyone.

© Stack Overflow or respective owner

Related posts about c

    Related posts about c++