Video Coming Soon...

Created by Zed A. Shaw Updated 2026-11-26 20:48:52
 

45: wc

WARNING: This is from the Go course but I'm rewriting the code and the description to fit C. If you want to attempt it go ahead. The challenge is the same, just no examples yet.

The wc command is so useful I even use it in Windows...by running wsl wc. I know, kind of dumb but that's how handy it is. The wc command does "word count" but it can count lines, words, characters, and bytes in a file. Mostly I use it to count the number of lines.

The Challenge

You'll be required to implement the following options to wc:

  • -c -- counts bytes.
  • -m -- counts chars.
  • -w -- counts words.
  • -l -- counts lines.

That's actually most of the tools functionality, so let's add on that your output has to exactly match the output of the original tool.

You can find the documentation here:

Previous Lesson Next Lesson

Register for From Impostor to Programmer

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.