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;
...

It acts as an if-else statement for example:

a = b < 10 ? true : false;

is the same as..

if (b < 10) {
	a = true;
} else {
	b = false;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.