Pages

Monday 19 December 2016

Variables And Constants In C || Part 1 ||

What are variables and constants ?


Variable in C : 


variable in C programming refers to a value whose value is always changing during the execution of a program . Variable is simply a value and that value changes according to condition.
Example: A name can be used to declare the variable.
Note: It Shouldn’t contain any number and special character.

Constants: 


Constants in C are the values which remains same even after the execution of the program. The value doesn’t changes after the execution.
Example: All numbers including string constants.

Declaring Variables And Constants:


Declaring a variable:


Data type integer name;

Example:
            int a;
            float b;

Declaring a constant:


Data type variable name=”Constant”;

In declaring a constant we must provide a variable to store the constant value.

Example:
              int a=10;
              float a=10.10;

In this post you should have learnt 2 things:

*Variables and constants

*how to declare them(only examles)


If you didnt understand any thing !!! 😕

Don't worry simply comment  😊

Keep visiting.


Friday 16 December 2016

How to install Turbo C++ || Start Up Compiler ||

Install Turbo C++ :

 What are C compilers?

 we already know and how to install a compiler is difficult thing.
To install simply follow the instructions:
  1. Visit the web page and download the zip archive file https://turboc.codeplex.com/Run
  2. Extract the files to a folder.
  3. Run Turbo C++ 3.xx.msi
  4. Click on next
  5. Allow administrator previlage
  6. Accept the license agreement.
  7. After accepting click on next.
  8. Wait upto installation completes.

Still Complicated watch the tutorial:

Structure of a C program || C program Body

Structure of a Program:

C program consists of mainly 5 parts:

*  Preprocessor directives (header files), Global declarations.

*  Main function.

* A pair of braces( before starting main function and remaining at the end) .

*Set of Statements(local declarations,user statements)

* User defined functions(if any).

What are these components?  😕

Don't worry have a look on simple C program :

Preprocessor directives: These are also called as header files.These files includes the every information of the prototypes.Example:Standard i/p & o/p header (stdio) contains information and how to process the prototypes such as printf(); scanf(); etc.... 

Main function: it is the main part of the program.Always the C compiler executes the statements of main function. Example: void main(),int main().
Pair of braces:These braces are used to separate the set of statements as main function and user defined functions.
Set of statements:These are the collections of  statements designed by the programmer to do a specific task.
User defined functions: These are set of programmer defined statements.Programmers use this to do a special task. Rather than main function we can use custom functions according to
our requirements. 

Have a daily look on blog to get more stuffs.

Thursday 15 December 2016

Best C compiler Ever || Turbo C++


Which is best  C compiler?





First you need to know what are compilers?
then only you can able to run the codes.
I Am using turbo c++ compiler.It is for windows operating system.
It has so much options to code and debug.You can get turbo c++ compiler here
https://turboc.codeplex.com/

Turbo c++ shows the error in a line with the line no and easy error detecting words.

Two useful shortcuts:

Compile:ALT+F9

Run:CTRL+F9

Keep visiting for new and updated stuffs.

How to swap two variables without using the third variable || C Programming||

what is swapping?

swapping refers to exchanging the values of two variables.
for example if a=1 and b=2.Then swapping is changing value of a to b and b to a.
Here after swapping a=2 and b=1.
By C program too we can swap two values.
I am swapping two variables without using third variable.

 Program to swap:



#include<stdio.h>

void main()

{

int a,b;

printf("\n Enter a and b to swap\n");

scanf("%d%d",&a,&b);

\\Logic

a=a+b;

b=a-b;

a=a-b;

printf("\n Swapped values are \ta=%d\tb=%d",a,b);

}

Video tutorial: