Thread: C Programming Tutorials

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    2

    C Programming Tutorials

    C Programming Tutorials By sid3arm

    Index


    Chapter 1

    1. Introduction
    2. Introduction To C

    Chapter 2

    1. A Basic C program
    2. Showing some tips to make a hellworld look better - Coming soon -
    __________________________________________________ ___________

    Introduction

    Welcome to " C programming " from Sid3arm

    skillz needed to do this course or start this course..

    * NO PROGRAMMING EXPERIENCE IS ASSUMED

    But if you have programmed in basic it will help a little bit not to much tho, anyways will move on now.

    * This Course will cover topics from a introductory level to a Advanced level

    Ok the we are going to start with the most basic program to write in C and that is called a helloworld program and then from there we will slowy work our way up learning new stuff and consepts & point funtion points and many more...
    __________________________________________________ ___________

    Introduction To C

    Hello and welcome to Introduction To C now i would like to start off by saying that

    * C is a Low-level but yet structured

    * C is very hard to write GUI in i would say use C# but will talk about this after

    * C is a Procedural language.

    * C is a Multi-platform/Portable language

    * is a a very poweful programming languge in fact it is to powerful C allows the programmer to do anything that the OS there working on is capable of you can do anythink is C even if that thing your trying to do is avisable or out right evil

    * Complex - C is not a good learing language
    " C retains the basic philosophy that programmers know what they are doing "

    * Versions of C

    -"Kernigham and Ritchie " C
    - ANSI C
    - C++ - C++ is not C it is a other programming languge
    - C#, Java
    If your thing abut getting in to C Programming alot or want to do this i would say get this book

    The C programming Language ANSI C Second Edition

    This is not for learn it is for lookup and and for when you forget some stuff it is classed as the C programmers bibe
    __________________________________________________ ___________

    A Basic C program

    * We are going to creare a " helloworld " program
    " A very simple program to print helloworld on the screen "

    We are all so going to look at

    -printf
    -scanf
    -getchar

    Ok now will get on to the programming..

    Now open Open your notepad or Complier and type in

    Code:
    main()
    {
        printf("Helloworld");
        getchar();
    }
    ok now ill tell you a lil about this code you just wrote ..

    * printf("What eva is in here is printed on the screen with in the DOS box")
    * getchar(); = stop the DOS box from auto closing it just pauses the DOS screen and wait for it to be closed

    Ok now will just make the code abit more user friendly

    How do you think we would do this ??????

    i want you to try this befor reading how i did it .. Thank you

    if you dont know it is fine if you knew it was done like like this then you was right if you got it wrong it ok


    Here is how you do it


    Code:
    main()
    {
        printf("Helloworld\n");
        printf("Thank you, for viewing my helloworld :)\n");
        printf("Please press enter to exit..\n");
        getchar();
    }

    ok now you know how to use printf and getchar will move on to a scanf funtion


    Now with this code we just did.. we are goign to add a variable to our helloworld program

    Code:
    main()
    {
        int       age;
    
    
        printf("Helloworld\n");
        age = 18;
        printf("My age is %d\n");
        printf("Thank you, for viewing my helloworld :)\n");
        printf("Please press enter to exit..\n");
        getchar();
    }
    Ok did you run that .. See how a Variable works..

    Now you know how to use printf, getchar & scanf next will show you have to clear the text from the screen after your down with it ..

    ill give yous a tip for now

    system("somethink need to go in here to clear text do you know what ");
    __________________________________________________ ___________

    More coming very soon

    ----------------
    By : Sid3arm |
    ----------------

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    This is a place for asking specific help, not a place to dump tutorials.

  3. #3
    Registered User
    Join Date
    May 2007
    Posts
    2
    Well Oh sorry do want it deleted

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Quote Originally Posted by F33N View Post
    * Versions of C

    -"Kernigham and Ritchie " C
    - ANSI C
    - C++ - C++ is not C it is a other programming languge
    - C#, Java
    Since when is Java a version of C?

  5. #5
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    - C++ - C++ is not C it is a other programming languge
    C is a subset of C++...

    C# isn't C either.

  6. #6
    Registered User
    Join Date
    Sep 2006
    Posts
    835
    I know that K&R2 declare main() as
    Code:
    main() {
    which relies on C89's implicit int return value, but in C99 it's mandatory to explicitly specify the return value. See

    http://faq.cprogramming.com/cgi-bin/...&id=1043284376

    Another issue with K&R2 is that they cast malloc(), even though by the second edition, with the introduction of the void pointer, it was no longer necessary. See

    http://faq.cprogramming.com/cgi-bin/...&id=1043284351

    You should also have an explicit "return 0;" at the end of main()'s body. It's not necessary in C99, but I believe that in C89, although the Standard doesn't actually require it, if you don't include it, the return value is undefined, which is bad (in C99 main() returns 0 automatically at the closing brace). Since most compilers don't fully implement C99 yet, it's good practice for C code to comply both with C89 and C99.

  7. #7
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Erm.......... you also forgot a very important header file called

    #include <stdio.h>
    Double Helix STL

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 04-06-2007, 05:10 PM
  2. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 10:39 PM
  3. Wiki for Tutorials
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 08-16-2005, 03:03 PM
  4. CProgramming.com should update their tutorials.
    By PorkyChop in forum C++ Programming
    Replies: 17
    Last Post: 09-19-2004, 10:51 PM
  5. Best way to organize tutorials
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 05-30-2004, 04:41 AM