-6

long i, b = get();

equals to

long i; long b = get();

or

long b = get(); long i = b; ?

I'm totally new to c

Sato
  • 8,192
  • 17
  • 60
  • 115

1 Answers1

3

It is first option

long i;
long b = get();

You would find it out faster by trying then asking on SO.

It's called operator ,.

In this case both expressions are evaluated, but only second's value is returned.

int x = 5;

while (--x, x > 0)
{
    printf("%d,", x);
}

has output

4,3,2,1,

This code is same as

--x;
while (x > 0)
{
    printf("%d,", x);
    --x;
}
kocica
  • 6,412
  • 2
  • 14
  • 35
  • `long i, b = get();` and "It's called operator ,." --> No. it is not the comma operator anymore than `foo(1,2,3);` or `int a,b,c;` has a common operator. `x = rand(),1;` has a comma operator. – chux - Reinstate Monica Aug 10 '17 at 17:57