1. 程式人生 > 其它 >02. C Pro 的一些基礎小隨筆

02. C Pro 的一些基礎小隨筆

/* 楊輝三角
int i, j, N=10, yy[11][12] = { 0 };
yy[1][1] = 1;
printf("%d\n", yy[1][1]);
for (i = 2; i <= N; i++) {
  for (j = 1; j <= i; j++) {
    yy[i][j] = yy[i - 1][j - 1] + yy[i - 1][j];
    if (yy[i][j] == 0) continue;
    printf("%d\t", yy[i][j]);
  }
  printf("\n");
}
*/

/* 下一跳指標
int * tmp, a[5];
tmp = a;
for (int i = 0; i < 5; i++) {
  *tmp = i;
  printf("%d %d\n",*tmp,tmp);
  tmp += 1;   //自動跳到下一個資料型別的位置
}
*/

/*
int count=0;
char ch;
while ((ch = getchar()) != '\n') {
  if (ch == ' ') break;
  count++;
}
AAA:; //空語句
printf("input %d chars", count);
*/

/* %*3d 跳脫賦值
int a, b, c, d;
scanf("%2d%*3d%3d%d", &a, &b, &c, &d);
printf("%d %d %d %d", a, b, c, d);
*/

/* gets_s 和 scanf 的區別
char str[100];
puts(gets_s(str));
scanf("%s", &str);
printf("%s", str);
*/

/* 強制清空IOStream
putchar(getchar());
fflush(stdin);
putchar(getchar());
putchar('\n');
*/