C Language

C – Introduction

History: Programming language: For example: Banking application store Accounts data and perform transactions like withdraw, deposit etc. Applications: are mainly two types Note: C is Platform Dependent by which we can develop only Standalone applications Platform Dependency: Note: We use technologies to develop Web applications which are platform independent C-software: Download the latest version of …

C – Introduction Read More »

C – Programming Elements

Program Elements: Program is a set of instructions.Every Program consists, Syntax Examples     datatype identity = value; int age = 23; double salary = 35000.00; char gender = ‘M’; char* name = “Amar”;   Syntax Example returntype identity(arguments)          {       body;          }   int add(int a, int b)           {       int …

C – Programming Elements Read More »

C – Program Structure

Program: Main.c #include<stdio.h>void main(){            printf(“Hello”);} Application: Main.c Arithmetic.c #include<arithmetic.c>void main(){            // invoking functions            add();            subtract();} #include<stdio.h>void add(){            printf(“Add”);}void subtract(){            printf(“Subtract”);} #include: Library: stdio.h math.h conio.h string.h graphics.h printf() scanf() sqrt() rand() clrscr() getch() strlen() strrev() circle() line()

C – Variables and Rules

Variables: Syntax:            datatype identifier = value; Examples:            char name[] = “amar”;            int age = 23;            char* mail =  “amar786@gmail.com”;            char gender = ‘M’;            double salary = 35000; Note: Value of a variable will change. For example “age of a person” Variable Declaration, Assignment, Modify and Initialization: Declaration: Assignment: Modify: Initialization: Rules to create variable: Variables classified …

C – Variables and Rules Read More »

C – Functions and Calling

main() function: User function: Calling the function: The following program clearly explains how the control back to calling function after execution of called function. Calling Function: the function from which other function called. Called Function: the function which is called from other function. We can invoke the function any number of times once it has …

C – Functions and Calling Read More »

C – Local and Global Variables

Local variables: int main(){            int a ; -> local variable} Local variables automatically initialize with garbage values. We cannot guess garbage value. #include<stdio.h>int main(){            int a;               printf(“%d \n”, a); -> Prints unknown value.            return 0;} Format specifiers: Data type Format specifier int %d char %c float %f string %s Display information of different data types: …

C – Local and Global Variables Read More »

C – Escape Characters

Escape Sequences: Performs specific action when we use inside the String. \b Backspace \n New line \r Carriage return \t Horizantal tab \v Vertical tab \\ Backslash \’ Single quote \” Double quote \0 Null Display String in multiple lines: #include<stdio.h>int main (){            printf(“String \ndisplayed \nin \nMultiple \nLines”);            return 0;} Display information with tab spaces: …

C – Escape Characters Read More »

C – Data Types

Data Types in C Data type: Data types are classified into: Primitive types: In the above diagram primitive types are generalized. Primitive types sub classified as follows Following table describes the data type with size, format specifier and limits: Character data type: Char type is used to store alphabets, symbols and digits. We represents character …

C – Data Types Read More »

C – Operators

Operators in C Operator: It is a symbol that performs operation on data. Assignment operator: This operator is used to store value into variable. Syntax:                  variable = value; Example: a = 10 a = b = 10; Example codes on Assignment operator: #include<stdio.h>int main(){            short a, b, c, d;            a = 10;            b = …

C – Operators Read More »

C – Programs using Arithmetic operators

Program to add 2 numbers: #include <stdio.h>int main() {            int a, b, c;            printf(“Enter two numbers : \n”);            scanf(“%d%d”, &a, &b);            c = a+b;            printf(“Sum is : %d \n”, c);            return 0;} Program to find the sum and average of 3 numbers: #include <stdio.h>int main(){            int a, b, c, sum, average;            printf(“Enter two numbers : …

C – Programs using Arithmetic operators Read More »

Scroll to Top