- 博客(7)
- 收藏
- 关注
原创 swap two values without temporary variable
int a, b;a ^= b;b ^= a;a ^= b;note: if a and b are pointers. this behavior probably will not work well. assume that a and b are pointing to the same varible simultaneously, if we do as the abo
2005-04-20 14:35:00 938
原创 Difference Between typedef and #define
first, You can extend a macro typename with other type specifiers, but not a typedef d typename. That is, #define peach int unsigned peach i; /* works fine */ typedef int banana; unsigned banana i; /
2005-04-07 20:18:00 856
原创 Don't put several declarators together in one typedef
typedef int *ptr, (*fun)(), arr[5]; /* ptr is the type "pointer to int" * fun is the type "pointer to a function returning int" * arr is the type "array of 5 ints" */ And never, ever, bury the typedef
2005-04-07 20:05:00 770
原创 how to use typedef
use an example to indicate. given, void (*signal(int sig, void (*func)(int)) ) (int); (You call signal() and pass it arguments to say which interrupt you are talking about, and which routine should be
2005-04-07 19:59:00 766
原创 how to read "char* const *(*next)();"
A. First, go to the variable name, "next", and note that it is directly enclosed by parentheses. B1. So we group it with what else is in the parentheses, to get "next is a pointer to...". B. Then we g
2005-04-07 19:45:00 871
原创 the precedence rule about declaration
A. Declarations are read by starting with the name and then reading in precedence order. B.The precedence, from high to low, is: B1. parentheses grouping together parts of a declarationB2. the postfix
2005-04-07 19:36:00 690
原创 在expert C上看到的一个好玩的东西
C提供的ctime()可以格式化出一个时间,参数类型是long。有趣的地方在这里,当定义一个最大的long类型数ox7FFFFFFF时,看看ctime的输出是什么,是2038年的一天(jan. 19如果我没记错),这个意味着按照现在的long型长度计算机只能计时到2038年。
2005-04-06 16:02:00 735
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人