Thursday, March 13, 2014

Mathematical operators

Mathematical expressionsExpressed in the CProcess
. X or nothing*multiplication
Mode%Modular quotient
//Quotient
+1++Unary increment
-1--Unary decrement
++Sum
--Difference

The expression of meaning may change for operator location. The right or left is important.
headerheader
A++ (postincrement)Firstly use A, than add 1 to the number.
++A ( preincrement )Firstly add 1 to the A, after use number.
A -- ( postdecrement )Firstly use A, than subtract 1 to the number.
-- A ( predecrement )Firstly subtract 1 to the A, after use number.


An example of a difference in meaning of change unory operator location; For example, should it be : a=4, b=5

headerheaderheaderheaderheaderheader
c=a++ *bc=a*b
a=a+1
c=4*5=20
a=4+1=5
a=5b=5c=20
c=++a–ba=a+1
c=a - b
a=4+1=5
c=5 - 5=0
a=5b=5c=0
c= -- a + b --a=a+1
c=a+b
b=b - 1
a=4 - 1=3
c=3+5=8
b=5 - 1=4
a=3b=4c=8
+/- Click and see the code that is about the article.
/* source : freelearncprogramming.blogspot.com */
#include <stdio.h>
main ()
{
int a,b,c;
float c1;
a=4;
b=5;
c=a++*b ;
c1=++a-b ;
printf ("c = %d \n",c);
printf ("c1 = %d \n",c1);
return 0;
}

Operators

Operators are symbols that used to perform mathematical, logical and assignment operations. These operators and the values ​​into the process is called operand. Operators can receive more than one operand. Operator that has one operand is called unary operators. The operators used in C language is analyzed in three groups.
  1. Mathematical,
  2. Logical,
  3. Assignment operators.

Main function

Almost all C programs consist of multiple functions. main () that should be found in all C programs is the program's main function. The function will be executed firstly is main (). The statements (lines of code) will be executed in the program {-} are written in curly brackets. The structure of each of the statements of brackets is called code blocks. A block of code has variables that is used in the program and commands to perform operations to be performed.

An example
 

+/- Click and see the code that is about the article.
/* The first C program */
/* We will see "Hello World !" on the screen. */
/* source : freelearncprogramming.blogspot.com */

#include <stdio.h>

main ()

{
printf("Hello World !");

return 0;

}

Preprocessor directives

Preprocessor directives starts with '#' and operate by the preprocessor before the program is compiled. Each preprocessor directives has a different function. #include and #define directives are most commonly used. #include directive is used in the program to include required code for the codes used for functions. For example, we have designed a program and we want to print the output to the screen. For this, we have to use printf function that is a standard function of the C language.
Printf ("Sample Output");
However, in order to run the printf function, we need to have files. To include this file to the program, #include <stdio.h> command line is written to the top of the program. Files with .h extension is called Header File in the C programming language. <stdio.h> header file contains the necessary codes for standard input-output operations.

Introduction to C Programming

One of today's most popular programming languages is ​​C. Forms the basis of many programming languages ​​C, the type of programming is one of the first to be learned. After learning of this type of programming, you will learn other languages ​​more quickly. For example, you will be able to produce games for android. Of course after learning Java that C connoisseurs are learning more quickly it..

History of C Language 

  1. In 1972, by Dennis Ritchie at AT & T Bell Laboratories has developed from the B language.
  2. The first book on the C language was written by Dennis Ritchie and Brain Kernighan in 1972.
  3. After this date, a lot of C application has been developed.
  4. Because of they do not act according to a certain standard, There was a lot of differences between applications.
  5. In 1983, ANSI (American National Standard Institute) C standard was created.

Characteristics of C Language

  1. C language is machine independent and portable.
  2. Portability means interoperability of the same program on different hardware and different operating systems.
  3. A language efficiency (productivity), is measured by space-saving and allow for rapid development of software.
  4. C programming language is widely used because of efficient, simple, yet powerful applications developed in structure, and being portable.