943,671 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Marked Solved
  • Views: 1545
  • C RSS
You are currently viewing page 1 of this multi-page discussion thread
Jul 31st, 2009
0

TurboC3 not compiling basic programs help....

Expand Post »
Hello...

Im a newb to both C programming and DaniWeb ..

the prob is tht i try to compile this program in TurboC3

#include <stdio.h>
#include<Conio.h>

main()
{
printf( "hello" );
getch();
}

when i press " alt+F9 " it says " Warning:: program should return a value" and no errors

When i press " Alt + F5 " I see nothing but a black screen and cursor on it (like in logo) when i have to get Hello....

wht can be the problem...

anything wrong in the program?

plz help me...

regards
yesh
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
yeshkadiyala is offline Offline
2 posts
since Jul 2009
Jul 31st, 2009
0

Re: TurboC3 not compiling basic programs help....

>>anything wrong in the program?

1. its int main().
2. Add return 0; as the last line in main()

3. Add '\n' to the end of Hello, making it "Hello\n"

4. You might need to add fflush(stdout) after that print statement.

If the above doesn't fix the problem then I don't know what's wrong.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is online now Online
21,949 posts
since Aug 2005
Jul 31st, 2009
0

Re: TurboC3 not compiling basic programs help....

As far as I know:

Alt + f9 -> just complile
use:
Ctrl + f9 -> compile + run

Last edited by Luckychap; Jul 31st, 2009 at 1:58 pm.
Reputation Points: 83
Solved Threads: 61
Posting Pro in Training
Luckychap is offline Offline
442 posts
since Aug 2006
Aug 1st, 2009
-1

Re: TurboC3 not compiling basic programs help....

If you write your program like this:

  1. #include <stdio.h>
  2. #include <conio.h>
  3. void main(){
  4. printf("\nHello World !!");
  5. getch();
  6. }


It should work..
Last edited by deepugtm; Aug 1st, 2009 at 7:25 am.
Reputation Points: 2
Solved Threads: 2
Junior Poster in Training
deepugtm is offline Offline
96 posts
since Aug 2008
Aug 1st, 2009
0

Re: TurboC3 not compiling basic programs help....

I am too new to c programming.I think as the program doesnt return any value you should either put void main,or give return 0 at the end of program.
Just take it as a suggestion not sure if it is tha solution.
Reputation Points: 8
Solved Threads: 2
Junior Poster in Training
alvalany is offline Offline
61 posts
since Jul 2009
Aug 1st, 2009
0

Re: TurboC3 not compiling basic programs help....

Click to Expand / Collapse  Quote originally posted by itzAB ...
I am too new to c programming.I think as the program doesnt return any value you should either put void main,
NEVER use void main()
Moderator
Reputation Points: 3278
Solved Threads: 890
Posting Sage
WaltP is offline Offline
7,717 posts
since May 2006
Aug 2nd, 2009
0

Re: TurboC3 not compiling basic programs help....

Hello...

Im a newb to both C programming and DaniWeb ..

the prob is tht i try to compile this program in TurboC3

#include <stdio.h>
#include<Conio.h>

main()
{
printf( "hello" );
getch();
}

when i press " alt+F9 " it says " Warning:: program should return a value" and no errors

When i press " Alt + F5 " I see nothing but a black screen and cursor on it (like in logo) when i have to get Hello....

wht can be the problem...

anything wrong in the program?

plz help me...

regards
yesh
1.CTRL+F9: to see the output
2. main should return int and nothing else
3. C is case sensitive, so Conio.h is wrong.
4. If I'm not wrong, ALT+F5 is used to hold the screen if you're not using getch().
5. Use code-tags to post your code.
Last edited by 9868; Aug 2nd, 2009 at 3:25 am.
Reputation Points: 45
Solved Threads: 7
Light Poster
9868 is offline Offline
36 posts
since Mar 2009
Aug 2nd, 2009
1

Re: TurboC3 not compiling basic programs help....

@OP
I apologise if this remark seems a little out of place with respect to your query, but I would suggest that you look at using an up-to-date setup. Turbo C is pretty dated.

Personally, for the Windows platform, I would recommend the MinGW toolchain in conjunction with your favourite editor or IDE. Codeblocks is a good IDE option and you can download it with MinGW as part of the package.

I use MinGW in conjunction with the CDT tooling in Eclipse. It works well - except that there are still some integration issues with the gdb debugger - but it's not a "show-stopper".
Last edited by yellowSnow; Aug 2nd, 2009 at 6:32 am.
Reputation Points: 651
Solved Threads: 35
Posting Whiz in Training
yellowSnow is offline Offline
201 posts
since Jul 2009
Aug 2nd, 2009
0

Re: TurboC3 not compiling basic programs help....

I should have posted this in my previous blurb. Here's a link to a sticky post at the head of the C forums page:

http://www.daniweb.com/forums/thread50370.html
Reputation Points: 651
Solved Threads: 35
Posting Whiz in Training
yellowSnow is offline Offline
201 posts
since Jul 2009
Aug 5th, 2009
0

Re: TurboC3 not compiling basic programs help....

u guys are gr8 ... thnx

by the way it worked for me... when I pressed ctrl + f9 & then alt+f5

and no matter wht I used ..
main() or void main() or int main() it worked for me

and return 0; solved the warning problem

thank u guys once again...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
yeshkadiyala is offline Offline
2 posts
since Jul 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: dice probability
Next Thread in C Forum Timeline: Pointers and Sorting Array by Even and Odd numbers





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC