|
-
Aug 23rd, 2001, 06:16 PM
#1
Thread Starter
Addicted Member
Problem With simple program
Hi, how are you all,
I am just starting out teaching myself C, and the C++, and i have written a simple program that is ment to produce:
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
But instead it just makes a 10 line space, meaning it has like 10 new lines and no X's.
Here is the source,
Code:
#include <stdio.h>
int x,y;
main()
{
for ( x = 0; x < 10; x++, printf( "\n" ) );
for ( y = 0; y < 10; y++);
printf( "X" );
return 0;
}
I compiled it on bot Windows, using Turbo C (the old old borland program), and that worked fine, then i tried to compile it on Linux Debian and that is where i have the problem.
This is the command line that i use to compile it on linux:
(assumes that the file name is ex0103.c)
gcc ex0103.c
Can someone please let me know what is wrong with the source code for linux, y does it work under windows but not in linux??
Thanks for your time
-|- Hurgh -|-
Email: [email protected]
Website: http://www.hurgh.org/
Unix, Linux, FreeBSD, OpenBSD, Solaris, Windows
C, C++, PHP, VB6, ASP, VBScript, JavaScript
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|