The old plain C language

A friend of mine is taking a basic course in computer programming, and actually he is studying the basic of C language. Yesterday he told me that he must do a very simple exercise that will print on screen a triangle like this

And so on. He asked me if I could review his solution before he give his program to the teacher, because he is moving from the old house to a new house and actually he do not have access to a computer to try his solution. This morning I decided to refresh my knowledge of C solving this simple exercise, I must admit that I love C/C++….I cannot explain but they are really fascinating languages (I love assembly language too)

#include “stdio.h”
#include “memory.h”
#define NUM_OF_CHARS 10
int main() {
char str[NUM_OF_CHARS + 1];
int I;
for (I = NUM_OF_CHARS; I > 0; –I) {
      str[I] = 
“%s\n”, str);

The ability to manage memory of a string is one of the feature that I missed most when I program in C#.


Published by

Ricci Gian Maria

.Net programmer, User group and community enthusiast, programmer - aspiring architect - and guitar player :). Visual Studio ALM MVP

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.