This is not an infinite loop, it will run a set number of times.
for (int i=0; i<50; i++) // The common for loop starts from "0" instead of "1", so don't write like this (int i=1; i<=50; i++) { printf("hello, world\n"); }