write down my thinking in C