Posts

Showing posts from 2016

What is C Programming

C is a programming language developed at AT & T’s Bell Laboratories of USA in 1972. It was designed and written by a man named Dennis Ritchie. In thelate seventies C beganto replace the more familiar languages of that  time like PL/I,ALGOL, etc. No one pushed C. It wasn’t made the ‘official’Bell Labs language. Thus, without anyadvertisement C’s reputation  spread and its pool of users grew. Ritchie seems to have been rather surprised that so many programmers preferred C to older languages like FORTRAN or PL/I, other newer ones like Pascal and APL. But, that's what happened. Possibly why C seems so popular is because it is reliable, simple and easy to use. Moreover, in an industry where newer languages, tools and technologies emerge and vanish day in and day out, a language that has survived for more than 3 decades has to be really good.C++, C# or Java make use of a principle called Object Oriented Programming (OOP) to organize the program. This organizing principle h...

The First C Program

Armed with the knowledge about the types of variables, constants & keywords the next logical step is to combine them to form instructions. However, instead of this, we would write our first C program now. Once we have done that we would see in detail the instructions that it made use of. Before we begin with our first C program do remember the following rules that are applicable to all C programs:  (a)  Each instruction in a C program is written as a separate statement. Therefore a complete C program would comprise of a series of statements.  (b) The statements in a program must appear in the same order in which we wish them to be executed; unless of course the logic of the problem demands a deliberate ‘jump’ or transfer of control to a statement, which is out of sequence.  (c) Blank spaces may be inserted between two words to improve the readability of the statement. However, no blank spaces are allowed within a variable, constant or keyword.  ...

Concept Number, Variable and Symbol

The alphabets, numbers and special symbols when properly combined form constants, variables and keywords. Let us see what are ‘constants’ and ‘variables’ in C. A constant is an entity that doesn’t change whereas a variable is an entity that may change. In any program we typically do lots of calculations. The results of these calculations are stored in computers memory. Like human memory the computer memory also consists of millions of cells. The calculated values are stored in these memory cells. To make the retrieval and usage of these values easy these memory cells (also called memory locations) are given names. Since the value stored in each location may change the names given to these locations are called variable names. Consider the following example. Here 3 is stored in a memory location and a name x is given to it. Then we are assigning a new value 5 to the same memory location x. This would overwrite the earlier value 3, since a memory location can hold only one value ...

C Keyword

Keywords are the words whose meaning has already been explained to the C compiler (or in a broad sense to the computer). The keywords cannotbe used as variable names because if we do so we are trying to assign a new meaning to the keyword, which is not allowed by the computer. Some C compilers allow you to construct variable names that exactly resemble the keywords. However, it would be safer not to mix up the variable names and the keywords. The keywords are also called ‘Reserved words’. There are only 32 keywords available in C. The keywords are:- auto, double, int, struct, break, else, long, switch, case, enum, register, typedef, char, extern, return, union, const, float, short, unsigned, continue, for, signed, void, default, goto, sizeof, volatile, do, if, static, while.

Calculator Using C Programming

#include<stdio.h> #include<conio.h> #include<math.h> void main() { int a; printf("options are :\n 1.add\t 2.sub\t 3.mul\t 4.div\t 5.mod\t"); scanf("%d",&a); if(a==1){     int b,c,d;     printf("enter  any two number");     scanf("%d%d",&b,&c);     d=b+c;     printf("the add result is %d",d); } else if(a==2){         int e,f,g;         printf("please enter any two number");         scanf("%d%d",&e,&f);         g=e-f;         printf("the sub result is %d",g); } else if(a==3){     int h,i,j;     printf("enter any two number");     scanf("%d%d",&h,&i);     j=h/i;     printf("the div result is %d",j); } else if(a==4) {     int k,l,m;     printf("enter any two number");     scanf("%d%...

Basic Of C programming

Communicating with a computer involves speaking the language the computer understands, which immediately rules out English as the language of communication with computer. However, there is a close analogy between learning English language and learning C language. The classical method of learning English is to first learn the alphabets used in the language, then learn to combine these alphabets to formwords, which in turn are combined to form sentences and sentences are combined to form paragraphs. Learning C is similar and easier. Instead of straight-away learning how to write programs,we must first know what alphabets, numbers and special symbols are usedin C, then how using them constants, variables and keywords are constructed, and finally how are these combined to forman instruction. A group of instructions would be combined later on to form a program. For example:- steps in learning English Language: Alphabets--->Words--->Sentences--->Paragraphs steps in learning...