Most of the pattern programs written in C or C++ are the same, but different in syntax. This is done so that you can have a pattern program, which can be reused and saved in a library. By doing so, you don't have to type the bunch of code over and over again again, and it is a lot faster than writing a new program each time. Read this article, as they have shown the most asked pattern programs in C