I don't really use C much but when you use scanf to get a variable into the char array pattern how come you only use one data position? like &pattern[1]... its a 2d array shouldn't you have two data...