Current location: Hot Scripts Forums » Programming Languages » C/C++ » C basic Tutorial


C basic Tutorial

Reply
  #1 (permalink)  
Old 05-27-10, 02:10 PM
EliteHussar EliteHussar is offline
Disabled
 
Join Date: May 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
C basic Tutorial

C Tutorial 1 – The basics of C
This tutorial is a port of the C++ tutorial but is designed to be a stand-alone introduction to C, even if you’ve never programmed before. Unless you have a particular reason to learn C instead of C++, I recommend starting the C++ tutorial instead. Nevertheless, if you do not desire some of C++’s advanced features or simply wish to start with a slightly less complicated language, then this tutorial is for you!
Programming tutorial
Reply With Quote
  #2 (permalink)  
Old 05-27-10, 02:20 PM
EliteHussar EliteHussar is offline
Disabled
 
Join Date: May 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
C Tutorial 2 -If statements

C Tutorial 2 -If statements
The ability to control the flow of your program, letting it make decisions on what code to execute, is valuable to the programmer. The if statement allows you to control if a program enters a section of code or not based on whether a given condition is true or false. One of the important functions of the if statement is that it allows the program to select an action based upon the user’s input. For example, by using an if statement to check a user-entered password, your program can decide whether a user is allowed access to the program.
Programming tutorial
Reply With Quote
  #3 (permalink)  
Old 05-27-10, 02:24 PM
EliteHussar EliteHussar is offline
Disabled
 
Join Date: May 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
C Tutorial 3 – Loops

C Tutorial 3 – Loops
Loops are used to repeat a block of code. Being able to have your program repeatedly execute a block of code is one of the most basic but useful tasks in programming — many programs or websites that produce extremely complex output (such as a message board) are really only executing a single task many times. (They may be executing a small number of tasks, but in principle, to produce a list of messages only requires repeating the operation of reading in some data and displaying it.) Now, think about what this means: a loop lets you write a very simple statement to produce a significantly greater result simply by repetition.
Programming tutorial
Reply With Quote
  #4 (permalink)  
Old 05-28-10, 11:41 AM
EliteHussar EliteHussar is offline
Disabled
 
Join Date: May 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Programming Tutorial

C Tutorial 4 – Functions
Now that you should have learned about variables, loops, and conditional statements it is time to learn about functions. You should have an idea of their uses as we have already used them and defined one in the guise of main. Getchar is another example of a function. In general, functions are blocks of code that perform a number of pre-defined commands to accomplish something productive. You can either use the built-in library functions or you can create your own functions.
C Tutorial 4 – Functions
Reply With Quote
  #5 (permalink)  
Old 05-28-10, 11:43 AM
EliteHussar EliteHussar is offline
Disabled
 
Join Date: May 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Programming Tutorial
C tutorial 5 – Switch case
Switch case statements are a substitute for long if statements that compare a variable to several “integral” values (“integral” values are simply values that can be expressed as an integer, such as the value of a char). The basic format for using switch case is outlined below. The value of the variable given into switch is compared to the value following each of the cases, and when one value matches the value of the variable, the computer continues executing the program from that point.

C tutorial 5 – Switch case
Reply With Quote
  #6 (permalink)  
Old 05-29-10, 04:01 PM
EliteHussar EliteHussar is offline
Disabled
 
Join Date: May 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
C Tutorial 4 – Functions

Programming Tutorial

C Tutorial 6 – An introduction to pointers
Pointers are an extremely powerful programming tool. They can make some things much easier, help improve your program’s efficiency, and even allow you to handle unlimited amounts of data. For example, using pointers is one way to have a function modify a variable passed to it. It is also possible to use pointers to dynamically allocate memory, which means that you can write programs that can handle nearly unlimited amounts of data on the fly–you don’t need to know, when you write the program, how much memory you need. Wow, that’s kind of cool. Actually, it’s very cool, as we’ll see in some of the next tutorials. For now, let’s just get a basic handle on what pointers are and how you use them.

C Tutorial 6 – An introduction to pointers
Reply With Quote
  #7 (permalink)  
Old 05-30-10, 06:20 PM
EliteHussar EliteHussar is offline
Disabled
 
Join Date: May 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Programming Tutorial
C tutorial 7 – Structures
When programming, it is often convenient to have a single name with which to refer to a group of a related values. Structures provide a way of storing many different values in variables of potentially different types under the same name. This makes it a more modular program, which is easier to modify because its design makes things more compact. Structs are generally useful whenever a lot of data needs to be grouped together–for instance, they can be used to hold records from a database or to store information about contacts in an address book. In the contacts example, a struct could be used that would hold all of the information about a single contact–name, address, phone number, and so forth.

C tutorial 7 – Structures
Reply With Quote
  #8 (permalink)  
Old 06-02-10, 05:00 PM
EliteHussar EliteHussar is offline
Disabled
 
Join Date: May 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Programming Tutorial
C Tutorial 8 – Arrays
Arrays are useful critters that often show up when it would be convenient to have one name for a group of variables of the same type that can be accessed by a numerical index. For example, a tic-tac-toe board can be held in an array and each element of the tic-tac-toe board can easily be accessed by its position (the upper left might be position 0 and the lower right position 8). At heart, arrays are essentially a way to store many values under the same name. You can make an array out of any data-type including structures and classes.

C Tutorial 8 – Arrays
Reply With Quote
Reply

Bookmarks

Tags
programming, tutorial


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic Tutorial CMS Needed Codingfreak Job Offers & Assistance 2 06-16-06 02:28 PM
Tutorial books for free - By Herong mark1048 General Advertisements 0 12-03-05 09:54 PM
Need Basic Mailing Tutorial BMS PHP 1 09-03-05 04:58 AM
[ANN] New script engine (Basic sintax) MKTMK C/C++ 2 08-22-05 05:32 AM
More info SLAYER18 Job Offers & Assistance 1 01-17-05 05:06 AM


All times are GMT -5. The time now is 04:40 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.