Posts

Concept of Storage Classes In C

Image
What are Storage Classes ? Storage classes in c programming are used to describe about the features of a variable/functions.  These features basically include scope , life time , default value, storage area of variable/functions in c. Scope : It means the area of code where a variable is accessible. Life Time : It means the time duration during runtime till which our variable is live or can be used. In this time duration doesn't means the actual time it related with function life where it is used for that duration. Default Value : It is the value which is assigned to variable initially when we declare it. Storage Area : It means where our variable data is stored whether it is in register or hard disk,etc. Types of Storage Classes Auto  * Any variable in c programming is auto variable by default. So, there is no need to use the keyword auto.   * if variable is not initialized , by default auto variable contains garbage value. * auto variable is...

Input Output in C Programs

Need of Input - Output Whenever we are using computers and performing different tasks ,there is alway involvement of input and output. for example, you want to play music the you insert the clip as input and what you get is the sound from the speakers which is a output of given input.  Therefore , for performing task such as playing music you need input- output . similarly you need input and output for each and every task in computer system. In C programming during runtime or program development you need input so that program can use those values and perform the particular given task and give specific output. C libraries provide many functions for input and output which are as follows : printf() function This inbuilt function of stdio.h header file is used to print data to the console screen (The black screen which we see when we run program). There are numerous forms of using printf function which can include printing string,character,integer,floating numbe...

Tips and Tricks for declaring Variables

Tips and Tricks for declaring variables Declaring variables is not a easy task. It is a difficult and mind confusing task. So here, I am providing some tips that can help you to declare variables easily in C Programming. Always try to follow following points : 1. Every variable name must start with a letter(a-z , A-Z) or a underscore( _ )  2. Never start a variable name with numbers,symbols,etc 3. A variable should not contains special characters like $  < * & ^ % #, etc 4. A variable can contain only digits,letters(it may be upper case or a lower case),underscore 5. Variables must be realistic and connected to real life problem, for example if you are writing a        program for calculating total marks of student then use the variables like total_marks,etc 6. Do not use short,letter names. for example, to store student total marks don't use the variables like a,b,f,m,etc. they are confusing names.  7. Avoid ...

sizeof() Operator | Sizes ,Precision and Range of different data types

sizeof() Operator This operator is used to find out size of variables,structures ,pointers ,etc in bytes. Program to understand sizeof() opertaor #include<stdio.h> #include<conio.h> void main() { int x,y; x=98; clrscr(); y=sizeof(x); //size of variable printf("%d",y); getch(); } See Output NOTE - We will use this operator in further posts and program to understand it more. Program to find out size, precision and range of different data types #include<stdio.h> #include<limits.h> #include<float.h> void main() { clsrcr(); printf("sizeof(char)=%u\n",sizeof(char)); printf("sizeof(short)=%u\n",sizeof(short)); printf("sizeof(int)=%u\n",sizeof(int)); printf("sizeof(long)=%u\n",sizeof(long)); printf("sizeof(float)=%u\n",sizeof(float)); printf("sizeof(double)=%u\n",sizeof(double)); printf("sizeof(long double)=%u\n",s...

Programs to Understand C fundamentals

Program to understand fundamenals Escape Sequence #include<stdio.h> #include<conio.h> void main() { clrscr(); printf("feel_the_coder\n"); // \n is the escape sequence printf("Subscibe Us\a"); // \a is also a escape sequence for a audible/visible alert printf("Give me space\t"); // \t is escape sequence and moves cursor to next horizontal tab getch(); } See Output Operators #include<stdio.h> #include<conio.h> void main() { int a,b,c; // variables a=10; b=5; c=a+b; clrscr(); if(a==10||b==6) // OR operator printf("%d",c); if(a==10&&b==5) // AND operator printf("%d",c); if(a!=b) // NOT operator printf("%d",c); getch(); } Note - if() is a conditional statement which you will study in subsequent posts. See Output Literals #include<stdio.h> #include<conio.h> void main(){ int x=5; float v=5.98; clrsc...

Environment For C | Program Development Steps

Image
Environment for C Some steps are involved in developing a c program which are as followed - 1. Program Creation 2. Program Compilation 3. Program Execution UNIX/LINUX  Environment                                                       1. Program Creation  * In UNIX C file can be created using vi editor as- $ vi filename.c * You can save this file by using ESC key and SHIFT+zz key. 2. Program Compilation * Program created in first step can be compiled using following command as- $cc filename.c * If your program contains mathematical operations the compile it as- $cc filename.c -lm * Compiled file which can be used for execution is stored in the file a.out * If you want your file to saved with specified name then compile it as follows-\ $cc filename.c -o executablename 3. Program E...

Design Methods | Process Of Software Development | Compilation

Image
Design Methods Designing is the first step for obtaining solution of a given problem.The purpose of designing is to represent solution for a system.It is difficult to design a large system because the complexity of system cannot be represented easily. Some of the design methods are given below. 1. Top-Down Design Every system has several hierarchies of components.The top level represents the whole system. Top-Down design starts from top level component to lowest components.In this design method,the system is divided into some major components. Then each major component is divided into lower level components.Similarly other components are divided until the lowest level component. 2. Bottom-Up Design Bottom-Up design method is reverse of Top-Down design approach.It starts from the lowest level components to the highest level components. It first designs the basic components and from these basic components highest level components are designed. 3. Modular Approac...