BEFORE LOOKING AT THE CODE SKELETON BELOW, PLEASE SPEND SOME TIME
TRYING TO DEVELOP YOUR OWN CODE (or at least pseudocode / algorithm).
Doing so would ensure you derive the most benefit from this exercise.

The code template below is "line accurate" to my code, i.e., my
complete program was 21 lines of code.  You can certainly use more
lines, or modify the skeleton below, or decide to write your own
code completely from scratch.  Scroll below to see.
























































































































































#include <stdio.h>

int N;                    // length of pattern
char pattern[11];         // at most 10 chars plus NULL

void makepatterns(int currentlevel) {
  if(currentlevel == ?)
    printf(?, ?);    // print a pattern
  else {
    pattern[?] = ?;       // set one character to something
    makepatterns(?);      // recursive call
    pattern[?] = ?;       // set it to something else
    makepatterns(?);      // recursive call
  } 
}

int main() {
  scanf("%d", &N);        // read N, pattern length
  pattern[N] = '\0';      // terminate string at position N
  makepatterns(0);        // generate all patterns (recursively)
}
