ComputerForum.com ComputerForum.com  
TigerDirect
 
Go Back   Computer Forum > Computer Software > General Software

Reply
 
LinkBack Thread Tools Display Modes
Old 11-08-2006, 09:46 PM   #1 (permalink)
Platinum Member
 
Join Date: Jun 2006
Location: Canada
Age: 18
Posts: 588
Default Completely New at Programming

alright so heres the deal im interested in learning to program
-ive chosen my compiler
-ive found some tutorials (very basic)

and im sure everyone knw the most commmon program is "Hello World"

the compiler porgram i am using is Dev-C++ and this is what it looks like (same as tutorials)

#include <stdio.h>
int main()
{
printf("Hello World\n");
return 0;
}

few questions
1 how do i run this program, ive compiled it and when i go to run it a black box pops up and closes
2. IS the very first line neccessary

help appreciated this is somthing i am interested in
thanks in advance
dark_legacy2006 is offline   Reply With Quote


Old 11-08-2006, 10:34 PM   #2 (permalink)
Platinum Member
 
Join Date: Jun 2006
Location: Canada
Age: 18
Posts: 588
Default

i knw ndouble post are annoying but i just need a quick answer
thanks again
dark_legacy2006 is offline   Reply With Quote
Old 11-10-2006, 04:11 AM   #3 (permalink)
New Member
 
NetworkDemon's Avatar
 
Join Date: Nov 2006
Posts: 1
Default

I see you're learning C, my favorite language by far . Although C may be extremely difficult to learn if you are new to programming, once you have the basic concepts mastered you'll be good to go since C is not a very "big" language. The easiest way to make this program behave the way you want it to (on a Windows platform) would be to add the getchar() function right before the return statement in main. So it would look something like this:

Code:
#include <stdio.h> /* "includes" the standard library */
int main(void)
{
    printf("Hello World\n");
    getchar(); /* waits for the user to press the enter key */
    return 0; /* exits the program */
}
The first line of code:
Code:
#include <stdio.h>
is necessary if you wish to have access to all the functions of the standard library. "printf" is an example of a function from the standard library. Not all of the functions in the standard library are immediately added to the program with this line of code. Only functions that are explicitly called for in the program will be included in the final executable.

I recommend that you pick up a copy of The Second Edition of The C Programming Language (ANSI C) by Brian W. Kernighan and Dennis M. Ritchie. Ritchie was the original developer of C and this book is basically the bible for the language. It's geared more toward existing programmers, but still can be easily understood by a beginner. My first programming language was C so if I can do it, anyone can .
__________________

NetworkDemon is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming newbie wanting advice ^^ Yoonsi General Software 1 10-23-2006 11:35 AM
anyone whos done/doing programming Livzz General Software 1 08-07-2006 11:13 AM
Learning Programming ? zenhawx General Software 5 06-26-2006 06:51 AM
Programming Diddy General Computer Chat 16 05-22-2006 12:12 AM
Programming on Mac? Rexhasta General Computer Chat 5 12-01-2005 02:25 PM



All times are GMT +1. The time now is 07:39 PM.


Powered by: vBulletin Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Copyright © 2002-2008 Computer Forum and Web Design Forum