Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: let there be const

...

Code Block
bgColor#FFCCCC
int main(int argc, const char *argv[]) {
  char *buff;

  buff = (char *)malloc(BUFSIZE);
  if (!buff) {
     /* handle error condition */
  }
  /* ... */
  free(buff);
  /* ... */
  strncpy(buff, argv[1], BUFSIZE-1);
}

...

Code Block
bgColor#ccccff
int main(int argc, const char *argv[]) {
  char *buff;

  buff = (char *)malloc(BUFSIZE);
  if (!buff) {
     /* handle error condition */
  }
  /* ... */
  strncpy(buff, argv[1], BUFSIZE-1);
  /* ... */
  free(buff);

}

...