Two Equal Signs in One Line?

后端 未结 10 901
北荒
北荒 2020-12-06 04:58

Could someone please explain what this does and how it is legal C code? I found this line in this code: http://code.google.com/p/compression-code/downloads/list, which is a

10条回答
  •  孤城傲影
    2020-12-06 05:53

    It sets both variables to zero.

    int i, j;
    i = j = 0;
    

    The same as writing

    int i, j;
    j = 0;
    i = j;
    

    or writing

    int i, j;
    i = 0;
    j = 0;
    

提交回复
热议问题