+ Reply to Thread
Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 33

Thread: Getting Started (C Programming)

  1. #21
    Join Date
    May 2008
    Posts
    2,126
    Blog Entries
    1
    Rep Power
    33

    Re: Getting Started (C Programming)

    Dude a standalone source file works fine.

    What are you talking about?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #22
    LogicKills's Avatar
    LogicKills is offline Programmer
    Join Date
    May 2008
    Location
    US
    Posts
    138
    Rep Power
    16

    Re: Getting Started (C Programming)

    Quote Originally Posted by MeTh0Dz|Reb0rn View Post
    Dude a standalone source file works fine.

    What are you talking about?
    -sigh- Methods, I presume our attempts at helping this kind of problem are futile..
    lol
    http://logickills.org
    Science - Math - Hacking - Tech

  4. #23
    Join Date
    May 2008
    Posts
    2,126
    Blog Entries
    1
    Rep Power
    33

    Re: Getting Started (C Programming)

    Lol

  5. #24
    itspallab is offline Newbie
    Join Date
    Sep 2008
    Posts
    1
    Rep Power
    0

    Re: Getting Started (C Programming)

    a lot of ebook links can be found
    at http:/eboook.webs.com open the site and
    click the tutorial link

  6. #25
    LogicKills's Avatar
    LogicKills is offline Programmer
    Join Date
    May 2008
    Location
    US
    Posts
    138
    Rep Power
    16

    Re: Getting Started (C Programming)

    Would a part II be popular?
    http://logickills.org
    Science - Math - Hacking - Tech

  7. #26
    Join Date
    Oct 2008
    Location
    Istog, Kosova
    Posts
    4,001
    Blog Entries
    1
    Rep Power
    40

    Re: Getting Started (C Programming)

    I am new in C so it might be very helpful. Great job!
    Interested in participating in community events?
    Want to harness your programming skill and turn it into absolute prowess?
    Come join our programming events!

  8. #27
    Zizooooo is offline Newbie
    Join Date
    Jul 2009
    Posts
    14
    Rep Power
    0

    Re: Getting Started (C Programming)

    nice tutorial I found it useful

  9. #28
    will38's Avatar
    will38 is offline Newbie
    Join Date
    Jul 2009
    Location
    Springboro, OH
    Posts
    8
    Rep Power
    0

    Re: Getting Started (C Programming)

    I am new to codecall and am trying to learn C++ as a first language for programming, and i had a few question on your code. (4 actually)

    when you use int main(void) what is the difference between using () and (something here)
    because i have seen it both ways. and also i know that within the {} brackets int means
    integer and does the term integer also apply in this situation?

    when using the printf function (its a function right?) couldn't you just use "cout" because i thought it did pretty much the same thing. Is there a difference?

    with the return(0) could you use any other number in between the parenthesis or does
    it even make a difference?

    Pertaining to using semicolons in C++ i understand that you have to use them at the end of statements. What exactly is a statement? Sometimes my compiler (Dev-C++) will
    tell me that there was an expected semicolon before a function like "cout" or "endl".

    If you could clarify any of these questions i would appreciate it greatly. I'm sorry for asking so many questions but i'm just trying to learn the C++ language as thoroughly as possible

    cheers, will

    EDIT - sorry i forgot to tell you that you did a great job on your tut. it clarified the #include(s) for me and showed me some different ways to do things. A part II would be nice too : )
    Last edited by will38; 07-30-2009 at 08:29 PM. Reason: forgot something

  10. #29
    Join Date
    Jul 2008
    Location
    Somewhere that is shorter to write than "In the gloomy shadows of my personal namespace"
    Posts
    10,725
    Blog Entries
    2
    Rep Power
    90

    Re: Getting Started (C Programming)

    Quote Originally Posted by will38 View Post
    I am new to codecall and am trying to learn C++ as a first language for programming, and i had a few question on your code. (4 actually)

    when you use int main(void) what is the difference between using () and (something here)
    because i have seen it both ways. and also i know that within the {} brackets int means
    integer and does the term integer also apply in this situation?

    when using the printf function (its a function right?) couldn't you just use "cout" because i thought it did pretty much the same thing. Is there a difference?

    with the return(0) could you use any other number in between the parenthesis or does
    it even make a difference?

    Pertaining to using semicolons in C++ i understand that you have to use them at the end of statements. What exactly is a statement? Sometimes my compiler (Dev-C++) will
    tell me that there was an expected semicolon before a function like "cout" or "endl".

    If you could clarify any of these questions i would appreciate it greatly. I'm sorry for asking so many questions but i'm just trying to learn the C++ language as thoroughly as possible

    cheers, will

    EDIT - sorry i forgot to tell you that you did a great job on your tut. it clarified the #include(s) for me and showed me some different ways to do things. A part II would be nice too : )
    I don't know how active the author of this tutorial is ATM, so I'll just give my answer.. Might also be better to start a new thread if you have questions? Anyway...

    1) When you have "something" within the () after int main, this "something" contains the command line options that are passed to your program at startup. Unless you want to use these options, you can just write int main() or int main(void).

    Code:
    int main (int argc, char* argv[])
    argc is the number of command line arguments (including the first one being path to executable), the argv parameter is an array of character arrays (strings) which contains the command line arguments.

    2) Yes, the integer also applies in this situation. Main is also a function, int is the return value from the function. In other words, main returns an int (integer).

    3) Cout and printf are not identical, though they are often used for the same things. The thing here is that this tutorial is a C tutorial, while cout is a C++ function (not available in C).

    4) The return statement specifies which value will be returned from the function. As I said above, the "int" tells us that main returns an int. The return value is passed to the operating system. What the operating system chooses to do with it might vary, but generally return(0) means success, while a different value means failure. So if your main function completed successfully you would return a 0, while if you encounter an error you might want to return e.g. 1.

    5) Dev-C++ is not a compiler :S It's an IDE.. Anyway, defining a statement can be a bit hard.. I advise you to pick up a book on C, or just study examples. I don't feel like going through all the syntax here...
    Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

  11. #30
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: Getting Started (C Programming)

    int main() accepts no command-line parameters.
    int main(int argc, char* argv[]) accepts command-line parameters.

    cout does not exist in C, only in C++.

    return 0 indicates successful execution. Other return values would indicate a failure and the nature of it.

    The precise definition of what counts as a statement is a little... complicated. It takes about a page in Bjarne Stroustrup's The C++ Programming Language.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

+ Reply to Thread
Page 3 of 4 FirstFirst 1234 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. getting started with programming
    By leciel in forum Programming Theory
    Replies: 12
    Last Post: 12-05-2009, 12:08 PM
  2. Writing/programming drivers - getting started
    By Marcinnnn in forum C and C++
    Replies: 3
    Last Post: 09-07-2009, 12:55 PM
  3. Getting started
    By Gabriel in forum Visual Basic Programming
    Replies: 4
    Last Post: 11-01-2007, 11:07 AM
  4. Need help getting started
    By Nichie in forum C and C++
    Replies: 1
    Last Post: 03-22-2007, 09:17 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts