Code:#include<stdio.h> #include<conio.h> int main() { int c; clrscr(); for(c=0;c<10;c++) { printf("%*d\n",c,c); } getch(); return 0; }
Code:#include<stdio.h> #include<conio.h> int main() { int c; clrscr(); for(c=0;c<10;c++) { printf("%*d\n",c,c); } getch(); return 0; }
Last edited by Salem; 10-25-2008 at 09:08 AM. Reason: Snipped email address
I'm going to guess the output looks like this:
I have never used conio.h but presumably this is a library of console functions including clrscr().Code:0 1 2 3 4 [..etc]
The for loop uses the incrementing c value as the padding in the printf. If it read printf("% 3d\n",c,c); the output would be:
Code:0 1 2 3 4 [..etc]
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
It works by calling various C library routines to change what is seen in the console window. I'm guessing that this answer is about as useful as your question.
If you're not simply asking for someone else to provide the comments for a program which you copied off someone else, rather than writing it yourself, then please ask a more specific question.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"