Why isn't there a "<
This question already has an answer here:
-->
is not one operator, it is two; (post) decrement and less than. C is whitespace agnostic for the most part, so:
x --> y
/* is the same as */
x-- > y
<--
is the same idea:
x <-- y
/* is the same as */
x < --y
Perhaps you are confusing ->
with -->
. ->
dereferences a pointer to get at a member of the type it refers to.
typedef struct
{
int x;
} foo;
int main(void)
{
foo f = {1};
foo *fp = &f;
printf("%d", fp->x);
return 0;
}
<-
is simply not an operator at all.
This is not an operator but two operators: <
and --
. The code is identical to
#include<stdio.h>
void main()
{
int x = 5;
while(0 < --x)
printf("%d",x);
}
As I see it, that is just a "less than" < operator followed by decreasing the variable x (--). It is not one operator, but two. And -- has precedence over <.
链接地址: http://www.djcxy.com/p/1978.html上一篇: Java表达式
下一篇: 为什么没有“<”