Pset2 補遺

  • argv is an "array" of strings.
  • argc is an int that equals the number of strings that are in argv, so you’d best check the value of argc before opening a locker that might not exist! Ideally, argc will be 2. Why? Well, recall that inside of argv[0], by default, is a program’s own name. So argc will always be at least 1.
  • You’ll need to convert that string to an actual int. As luck would have it, a function, atoi, exists for exactly that purposes. : 例えば、int k = atoi(argv[1]); と使う。