Facebook
From Tiny Sheep, 5 Years ago, written in Plain Text.
This paste is a reply to Re: Untitled from Obese Lion - view diff
Embed
Download Paste or View Raw
Hits: 336
  1. #include <stdio.h>
  2. int main(int argc, char *argv[])
  3. {
  4.  int i = 0;
  5.  // go through each string in argv
  6.  // why am I skipping argv[0]?
  7.  for(i = 1; i < argc; i++) {
  8.  printf("arg %d: %s\n", i, argv[i]);
  9.  }
  10.  // let's make our own array of strings
  11.  char *states[] = {
  12.  "California", "Oregon",
  13.  "Washington", "Texas"
  14.  };
  15.  int num_states = 4;
  16.  for(i = 0; i < num_states; i++) {
  17.  printf("state %d: %s\n", i, states[i]);
  18.  }
  19.  return 0;
  20. }
  21.