Skip to main content


Showing posts from February, 2016

New trends and advantages of C language.

1. You can program the ROBOTS and  Automatic Running Machines  using C language. click here for more information.  2. For building more advanced  software or  Games you need to  learn more advanced languages like  Visual  Basic,  .NET, JAVA, ANDROID programming which is based on C.  3. To build a website you need only HTML and you can make your own website but for making it more advance you need to learn more web designing languages like CSS, JavaScript, Ajax, PHP and this all languages are very easy to learn if you have some basic knowledge about C. 4. After learning C you will be able to make your own software like Calculator, Games, Embedded Softwares, Compilers.

Why should I learn Computer language (Programming)? And why C language good for beginners?

1. Software is the spirit  ( आत्मा )  of hardware . 2. Just by joining some hardware (Electronics  Components) we can’t make our  Computers, Laptops, Mobiles, Tablets, etc. so programming is essential to make this hardware functional. 3. Program instructs and controls the hardware and C is the very basic language to start. 1. By learning a computer language you'll able to build your own software, OS, Virus, Antivirus. For example, WhatsApp, Hike, Calculator,  Media  Player, Facebook, Twitter. 5. After learning the C language you'll be able to build your own computer applications. 6. C language Helps to learn more advanced languages like Java, Dot Net, MATLAB. because this all language depends upon C language. 7. It is good for starters because it is just like the English language and easy to understand.

C Compilers

  C  language  is  same  as English  language  means  it  is  understandable  to  human  but  the hardware  will  not  able  to  understand  human  language  because  it  understands  only  the Machine Language we  don’t  need  to  go  in  deep  about  Machine  Language  just  remember  it. Therefore  to communicate with machines we have to convert our language into machine language for that we need compiler (Compiler is nothing but a Computer software). Compiler can convert our C language into Machine Language. Standard Definition of Compiler Compiler is a computer program which converts the source code written in one programming language into another programming language C language Compilers To execute the C program you have to write C program in a FILE and save the file as anything you want along with dot C (.C) extension example “hello.c” or “hello.C” .c can be small or capital it is not case sensitive. Some C Compilers are TurboC/C++, Eclipse, NetBeans, Code::Blocks, Digital Mars,

Constants and Variables in C

  Constants in C : Constants are the terms that can't be changed during the execution of a program. Examples : Integer Constants: 0, 1, 2, 3, 4, 5, 6, 7 . . . . . . . Floating Constants : 0.0, 0.1, 0.2, 0.3, -0.4, 0.5, 5.1546, 2.5465, -1.02545 . . . . . . .  Character  Constants :  Character  constants  are  the  constant  which  use  single  quotation  around  characters. For example: 'a', 'l', 'm', 'F' etc. Variables in C: Variables are memory location in computer's memory to store data. To indicate the memory location, each variable should be given a unique name called identifier. Variable names are just  the  symbolic  representation  of  a  memory  location.  Examples  of  variable  name:  ABC,  var_no, var_123, Var123, Count etc. Basic Data Types in C:  Char : a single byte that can hold a character (‘a’, ’b’, ’c’, ’d’, ’e’ . . . . . . . )  Int : An Integer can hold 2 or 4 byte integers (0, 1, 2, 3, 4, 5, 6, 7 . . . . . . .) Float : A float

Comments in C

  Comment is the code which is not executable means compiler will not compile the comments and that’s why comments are not visible on output screen. Two types of Commenting: Type 1:  double slash ‘ // ’ method the whole statement after double slash is not executed by compiler Example: try to run below code its output will be blank screen #include <stdio.h> void main(){ // printf (“Hello World!”); } #include<stdio.h> void main ( ){ //Comments // Comment printf (“Hello World!”);//abc } #include<stdio.h> //Comments void main(){ //Comments printf(“Hello World”); } o/p:  blank screen O/p:  Hello World! O/p:  Hello World In this way you can give multiple comments anywhere in the program but double slash is used to  comment only single line for commenting multiple lines use type 2.  Type 2:  For multiline commenting or for commenting a whole paragraph from the program we have  to add /* at the start of comment and */ at the end of comment as shown in examples: #include <s

Escape Sequences

  Sometimes, it is required to use newline, tab, quotation mark etc. in the program which  either  cannot  be  typed  or  has  special  meaning  in  C  programming.  In  such  cases, escape sequence are used. For that incident \n is used for newline. The backslash “\” causes escape from the standard way the characters are interpreted by the compiler. This escape sequences are only used in printing statements like printf for example:  printf(“\n Hello \t World!”).  Table of Escape Sequences: Escape Character \b Backspace \f Form feed \n Newline \r Return \t Horizontal tab \v Vertical tab \\ Backslash \’ Single quotation mark \* Double quotation mark \? Question mark \0 Null character Examples created on escape sequence: #include <stdio.h> void main(){ printf (“\nHello\nWorld!”); } #include<stdio.h> void main ( ){  Comment printf (“Hello\tWorld!”); } #include<stdio.h> void main(){ printf(“Hello World” \n); } o/p:  Hello World O/p: Hello        World! O/p:  Error Note: S

Header Files

  Header  files    in  the  program  are  included  before    main ( )    function between < > after writing #include as shown in above examples #include <stdio.h> is written. All header files are present in compiler  if  you  are  using  TurboC  then  you  can  see  this  in   INCLUDE   folder “ C:\TurboC++\Disk\TurboC3\INCLUDE ” there are so many header files are present this are named along with .h. in chapter header files we will see how to create your own header file. Examples of header files : stdio.h, conio.h, math.h, graphics.h, string.h, io.h, malloc.h and so on. You don’t need to memorize all header files basically in this book we are going to use only 4-5 header files. “ 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.  “ Let’s see in short some header files: stdio.h: It means Standard Input Output (stdio) header file in which output function printf () is defi

Getting Started with C

  Basic Syntax of C: Basically the C program is starting from “main()” and the whole programming is done inside the two curly braces after main. You can write this as void main () {  } OR void main(){ } OR void main() { } Before main()  we  always  write  some  return  type void  ,  int,  float,  double,  char  as  shows  in above example void is used. We will discuss later on about return type because it can be better understand after chapter Function.. Basic program in C: Try to run the below program. Here in this program we are printing Hello World! By  using printf(“”);  function anything  written  in  between  double  quotes“  ” is  printed  on output screen. #include <stdio.h> void main()    { printf(“Hello World!”);  }

Programming in Turbo C

  Make your own first software in your life just for demo I am showing you to make your basic   SUM two digit calculator   by using C language Step1 : Open TurboC you will get this window Step2 : Open New File by clicking on File>>New Step3 : Type this Sample Program in it. #include<stdio.h> #include<conio.h> void main() { float a, b, sum; clrscr(); printf("\t\t-:My First Software:-\n"); printf("\tA="); scanf("%f", &a); printf("\n\tB="); scanf("%f", &b); sum = a+b; printf("\n\tA+B=%f", sum); getch(); } Step4 : Save as any name as you want along with dot C (.C) or (.c) extension for example “ anyname.c ”. By Clicking on File>>Save as Step5 : Compile it by clicking on Compile>>Compile & Run it By Clicking on RUN After running program a black window will be open. Step6 : Enter any first Digit and press Enter button of PC Enter any second Digit and press Enter button of PC And you will get