Was macht das? [Duplikat]

Mögliche Duplikate:
Der ternäre (bedingte) Operator in C

Dies ist ein Codebeispiel meiner Lehrerunterstützung. Ich habe keine Ahnung wastotal = total*2+ (n=='1'? 1:0); tut. Ich denke es multipliziert die Summe mit 2, aber was ist mit dem Fragezeichen und dem1:0 Verhältnis ?

int bcvt(FILE *infile){
  char n;
  int i, total=0;
  for(i=0; i<32; i++){    
    fscanf(infile, "%c", &n);
    total = total*2+ (n=='1'? 1:0);
  }
  char dummy;
  fscanf(infile, "%c", &dummy);
  return total;
}

Antworten auf die Frage(4)

Ihre Antwort auf die Frage