How to run valgrind with basic c example?

It looks good. You only need to add a ./ before your executable. Without it, valgrind fails to find it and reports 'command not found'.

valgrind --tool=memcheck --leak-check=yes ./example1
                                          ^

First, compile your C program (-g is extremely important; without debug info in the executable valgrind cannot tell you line numbers from the source code where the violations occur nor the original line of the allocations of the memory being violated.):

gcc -g example1.c -o example1

Then run valgrind on the executable:

valgrind --tool=memcheck --leak-check=yes ./example1