1. Program Comments
To facilitate the reading process flow of a program, a programmer should write the comments in the syntax of the program. The definition of the commentary is part of the program itself (as text) in the program who was not executed during the compilation process. Comments in C made by adding '/ *' and ends with'*/'.
2. Variable
The variable is a recognition in the program that allows you to save the value of a particular data type. The value stored in a variable is dynamic, meaning that value can be changed during program run. To use variables, of course we touched declare them first so the compiler can recognize them. Here are the general form for declaring variables in C language.
type name_variable _data;
For example:
int x; / * declare a variable x with type int * /
float y; / * declare a variable x with float data type * /
As for the terms of the naming of variables, namely:
1. C language is a language that is case-sensitive (use uppercase and lowercase letters in a very different variables),
2. The variable name must not be a number preceded by a character or a number. Example:
int 23 / * incorrect * /
int s32 /*benar*/
int S32 / * true * /
1. The variable name must not contain spaces,
2. The variable name may not use the characters that are symbols (@,#,?, etc.).
3. The variable name must not use keywords or macro that has been defined in the C language
* Variable Scope
In a progarm, variable scope is determined by the spot where he declared. According to the scope, the variable can be divided into two, namely global variables and local variables.
1. Global Variables
Global variables are variables that are declared outside the function, both primary functions and other support functions.
2. Local Variables
Local variables are variables declared inside a function shingga can only be identified and accessed by function alone2.
* Variable Types
By type, variables in C can be divided into four kinds, namely automatic variables, static, external, and registers.
1. Variable Automatic
Automatic variables are variables known only within a block only (in sign {...}), either in block selection, repetition or function.
2. Static Variables
Is a variable that stores suati permanent value in a memory, meaning that the variable will store the last niali given.
3. External Variables
C language syntax allows us to write the program into a separate file with a program aimed to modularization. Therefore if we want to declare a variable that can be recognized and accessed by each of the separate file, then the variable that we have declare as external variables. As for how dalah adding the keyword extern at the time of declaration.
4. Register Variables
Unlike other variables that will be stored in memory, the register variables will be stored in CPU registers so that program execution will be faster.
*Data Type
The simplicity of this data type is, eg 10 is the data type integer, 11:45 is the real number data type and the 'A' type character.
1. Basic Data Type
In the language C are grouped into four categories, namely integer data type (integer), real numbers (floating-point), character or string and the type of logic (boolean).
3.1.1. Integer type
Integer type is a data type that is used to store the values that shaped integers (numbers that do not contain a comma), eg 20, 10 and so forth. But the integer is divided again into 2 ie, positive integers and negative integers. In the C language integer divided in a certain range eg integer (int).
3.1.2. Type of Real Numbers
Is a number that contains the value of fractions (containing a comma), eg 1:20, 2:45 and so on.
3.1.3. Character and String Types
Used to represent data in the form of characters. Data will be considered as a character if enclosed by single quotation marks ("), such as 'A', 'B', 'C' and so forth. Whereas if enclosed by double quotes (""), it will be regarded as a string such as "A", "B", "C language" and so forth.
3.1.4. Logic Type
Is the data type that represents the true value (true) and false (false).
3.1.5. Data Type formation
It is self-defined data types to meet the needs of the program that we will create. As for which are included in the data type is the type of array formation and structure.
3.1.6. Enumersi
Is a data type whose value has been defined with certainty at the time of manufacture of that type. This type is generally used to express something whose value is certain, as the name of the day, month, and so forth. As for making a enumersi in C is to use the enum keyword.
Kamis, 25 November 2010
COMMENT and TYPE VARIABLE DATA
Posted by
NEW..new
at
02.44
0
comments
Kirimkan Ini lewat Email
BlogThis!
Bagikan ke X
Berbagi ke Facebook
Labels:
C - Programming
Senin, 15 November 2010
INTRODUCTION TO C LANGUAGE
1. Preliminary
C is a powerful programming language and the flexibility that has been widely used by professional programmers to develop programs that vary widely in various fields. But before you learn more about the C language and its implementation, you should know in advance the components and basic knowledge of computer programming knowledge.
2. What is a Compiler?
Compiler can be interpreted as a translator, means the collection of program code written in a particular programming language will be translated by a compiler into assembly language, which would then be translated back into the object code so that the commands will be controlled by the computer (in this case the machine).
A compiler only recognizes certain languages in accordance with what has been created by the creators of such compiler.
3. Doing Compilation Program code
Computers do not know the meaning of program code written in C language because the computer only understands binary instructions, known as machine language. Thus it is necessary to other programs in order to translate the program code into machine language. Programs such as this is known as a compiler.
Compiler will accept the input code and the program will generate a code object to be stored in a file object. In the Windows operating system, this object will usually file extension .c, whereas in Unix or Linux operating systems in general, object files will be ending .o (by default in Linux would generate a.out file)
C is a powerful programming language and the flexibility that has been widely used by professional programmers to develop programs that vary widely in various fields. But before you learn more about the C language and its implementation, you should know in advance the components and basic knowledge of computer programming knowledge.
2. What is a Compiler?
Compiler can be interpreted as a translator, means the collection of program code written in a particular programming language will be translated by a compiler into assembly language, which would then be translated back into the object code so that the commands will be controlled by the computer (in this case the machine).
A compiler only recognizes certain languages in accordance with what has been created by the creators of such compiler.
3. Doing Compilation Program code
Computers do not know the meaning of program code written in C language because the computer only understands binary instructions, known as machine language. Thus it is necessary to other programs in order to translate the program code into machine language. Programs such as this is known as a compiler.
Compiler will accept the input code and the program will generate a code object to be stored in a file object. In the Windows operating system, this object will usually file extension .c, whereas in Unix or Linux operating systems in general, object files will be ending .o (by default in Linux would generate a.out file)
Posted by
NEW..new
at
22.50
0
comments
Kirimkan Ini lewat Email
BlogThis!
Bagikan ke X
Berbagi ke Facebook
Labels:
C - Programming
Quote of the Day
if we plant the rice then it is definitely going to grow grass
but if we do not expect to plant grass to grow rice
if we do that then the world will follow hereafter
but if we do that the world then the afterlife will not participate
but if we do not expect to plant grass to grow rice
if we do that then the world will follow hereafter
but if we do that the world then the afterlife will not participate