Tuesday, 24 February 2015

Procedural Programming ( operators)

Arithmetic Operators

The fundamental arithmetic operators and their corresponding symbols in C are:

  1. Addition +
  2. Subtraction -
  3. Multiplication *
  4. Division /
  5. Modulus % 

When the / operator is used to participate in integer division the resulting integer
is obtained through discarding (or truncating) the fractional a part of the precise
floating point value. 

For illustration:
1/2=0
3/2=1


Increment & Decrement operators 

 

Increment operator ++ adds 1 to its operand 
Decrement operator __ subtracts 1 from its operand

it are two types 
  1. pre increment / Decrement 
  2. post increment / Decrement 


 

Any question about arithmetic increment & Decrement  operators writes down in comment box. Everyday check this blog u will learn lot things of C programming and Web application development 

Procedural Programming ( operators)

The Assignment Operators

In C, the assignment operator is the equal sign = and is used to give a variable
the value of an expression. 
For example:

  1. i=0;
  2. x=34.8;
  3. sum=a+b;
  4. midinit='J';
  5. j=j+3;
When used in this manner, the equal sign should be read as “gets”. Note that
when assigning a character value the character should be enclosed in single
quotes.

In the assignment statement

a=7;

two things actually occur. The integer variable a gets the value of 7, and the
expression a=7 evaluates to 7
. This allows a shorthand for multiple
assignments of the same value to several variables in a single statement. Such
as

x=y=z=13.0;

as opposed to
x=13.0;
y=13.0;
z=13.0;


The following example illustrates two methods for variable initialization:



which produces the following output:


 Any question about assignment operators writes down in comment box. Everyday check this blog u will learn lot things of C programming and Web application development 

Sunday, 22 February 2015

Procedural Programming


Write your first C program



  1.  The C program starting point is identified by the word main(). 
  2.  This informs the computer as to where the program actually starts. The parentheses that follow the keyword main indicate that there are no arguments supplied to this program (this will be examined later on). 
  3. The two braces, { and }, signify the begin and end segments of the program. In general, braces are used throughout C to enclose a block of statements to be treated as a unit. 

N.B=COMMON ERROR: unbalanced number of open and close curly brackets! 

 


The purpose of the statement #include is to allow the use of the printf statement to provide program output. For each function built into the language, an associated header file must be included. Text to be displayed by printf() must be enclosed in double quotes. The program only has the one printf() statement. 



printf() is actually a function (procedure) in C that is used for printing variable’s values and text. Where text appears in double quotes "", it is printed without modification. There are some exceptions however. This has to do with the \ and % characters. These characters are modifiers, and in this code the \ followed by the n character represents a newline character.



Thus the program prints  Hello World !

 

And the cursor is set to the beginning of the next line. As we shall see later on,
the letter that follows the \ character will determine what special printing
action is taken (i.e., a tab, backspace, clear line, etc.)

/* My first program */ 


Comments can be inserted into C programs by bracketing text with the /* and
*/ delimiters. As will be discussed later, comments are useful for a variety of
reasons. Primarily they serve as internal documentation for program structure
and functionality.





 

Friday, 20 February 2015

How to coding in C (Lesson 3)

C Header files 

In the last lesson we saw how to declare a function in C.

what is header file?

A header file is a file with extension .h which contains C function declarations and macro definitions and to be shared between several source files.
Any header file is often a file having file extension .h. Which is usually has C functionality declarations and macro definitions also to possibly be discussed concerning a number of supplier data.

Include syntax

it has following to forms
  1. # include<stdio.h>
  2. # include "stdio.h"

# include (Insert a particular header from another file) 

# include <stdio.h>

Example 
  1. #include                                //This is needed to run printf() function. 
  2. int main() 
  3. printf("C Programming");         //displays the content inside quotation 
  4. return 0; 
  5. }

Explanation how this program works

  1. Every program starts from main() function. 
  2. printf() is a library function to display output which only works if #include is included at the beginning.
  3.  Here, stdio.h is a header file (standard input output header file) and #include is command to paste the code from the header file when necessary. When compiler encounters printf() function and doesn't find stdio.h header file, compiler shows error. 
  4.  Code return 0; indicates the end of program. You can ignore this statement but, it is good programming practice to use return 0;.
Here are the list of header files 


 Any question about header files writes down in comment box. Everyday check this blog u will learn lot things of C programming and Web application development

Wednesday, 18 February 2015

Procedural Programming ( C function)

                                       C Function                                   Lesson 2

What is function ?

  A function is a group of  statement that together perform a task.C program has at least one function which is main().

Example : As we noted earlier, using a function is  something like hiring a person to do a specific job for you.

Function declaration

A function declaration tells the compiler about a function's name, return type, and parameters. A function definition provides the actual body of the function.

Calling function

Function Arguments(Parameter Passing)

There are two ways that a C function can be called from a program. They are below
  • Call by value 
  • Call by reference 


We focus on call by value so that my beloved brother & sister in BAC can pass in Procedural Programming           

     

 

Any question about function and parameter passing writes down in comment box. Everyday check this blog u will learn lot things of C programming and Web application development

                                                                



 

Procedural Programming (Variables)



      How to start coding in C               Lesson 1


First of all you have to know C variable  

 

What is variable?  

A variable is nothing but a name given to a storage area that your programs can manipulate. Each variable in C has a specific type.


The name of a variable can be composed of letters, digits, and the underscore character.


Local Variables


Variable which might be declared in the functionality are usually known as nearby factors. Local variables can be used only by statements that are inside the block in which the variables are declared. Local variables exist only while the block of code in which they are declared is executing. Although its statement happen after the main ( ) function.

 

Global Variables


Unlike local variables, global variables are known throughout the program & may be used by any piece of code. Also, they will hold their value throughout the program's execution. Make a global variable by announcing them outer of any function. Although its declaration occurs before the main () function.




Any question about variable writes down in comment box. Everyday check this blog u will learn lot things of C programming and Web application development 

 



Monday, 16 February 2015

About CodeIgniter & MVC framework

                                 web application framework

CodeIgniter

CodeIgniter is an open source rapid development web application framework, for use in building dynamic web sites with PHP. The first public version of CodeIgniter was released on February 28, 2006, and the latest stable version 2.2.1 was released January 22, 2015.
(Reference From Wikipedia, the free encyclopedia) 


About CodeIgniter 

  •  CodeIgniter is a lightweight web application framework written in PHP that adopts the model-view-controller approach to development 

  • Open source 

  • Well-supported by an active community 

  •  Excellent “by example” documentation 

  •  Easy to configure 

  •  Supports multiple databases Uses MVC

    Here are basic knowledge of MVC framework 

 About MVC  

Separates User Interface From Business Logic 

● Model - Encapsulates core application data and functionality Business Logic.

● View - obtains data from the model and presents it to the user. 

● Controller - receives and translates input to requests on the model or the view

● Model in CodeIgniter is not enforced