Remember that printf() returns the number of displayed characters.
#include <stdio.h>
int main()
{
int i;
for(i = 0; printf("%d", i++) < 2;)
printf("\nEnd = %d\n", i);
return 0;
}
References: C From Theory