0

this is some of code.
I have a question. what is the meaning of '?' and ':1;' [just this part]

int t, dt, * cnt, tmax=0;
cnt=(int*)calloc(M,sizeof(int));
...
 /* Compute the mean-squared displacement using
     the straightforward algorithm */
  fprintf(stderr,"# computing...\n");fflush(stderr);
  for (t=0;t<M;t++) {
    for (dt=1;(t+dt)<tmax;dt++) {
      cnt[dt]++;  /* number of origins for interval length dt  */
      for (i=0;i<N;i++) {
	sdx[dt] += (rx[t+dt][i] - rx[t][i])*(rx[t+dt][i] - rx[t][i]);
	sdy[dt] += (ry[t+dt][i] - ry[t][i])*(ry[t+dt][i] - ry[t][i]);
	sdz[dt] += (rz[t+dt][i] - rz[t][i])*(rz[t+dt][i] - rz[t][i]);
      }
      sdcx[dt] += (cx[t+dt] - cx[t])*(cx[t+dt] - cx[t]);
      sdcy[dt] += (cy[t+dt] - cy[t])*(cy[t+dt] - cy[t]);
      sdcz[dt] += (cz[t+dt] - cz[t])*(cz[t+dt] - cz[t]);
    }
  }
  for (t=0;t<M;t++) {
    sdx[t] /= cnt[t]?(N*cnt[t]):1;
    sdy[t] /= cnt[t]?(N*cnt[t]):1;
    sdz[t] /= cnt[t]?(N*cnt[t]):1;
    sdcx[t] /= cnt[t]?(cnt[t]):1;
    sdcy[t] /= cnt[t]?(cnt[t]):1;
    sdcz[t] /= cnt[t]?(cnt[t]):1;
...
3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by William Hemsworth
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.