You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
269B

  1. #include<stdio.h>
  2. int main(){
  3. size_t N=10;
  4. double L=1.0e0;
  5. double a[N];
  6. double dx=L/((double)N - 1.0e0);
  7. for (int i = 0; i < N; i++) {
  8. a[i]=(double)i*dx;
  9. }
  10. FILE *fp;
  11. fp=fopen("restart.bin","w");
  12. fwrite(a, sizeof(a), 1, fp);
  13. fclose(fp);
  14. return(0);
  15. }