Importance of Programming Language
Introduction to C language:
//80% usually Means "excellent"
#include <stdio.h>
int main()
{ int n=80;
char ch='a';
printf("%d%% usually\n Means \?excellent\?\v",n);
printf("Learn\t with durga\v");//Learn with durga
printf("Never stop learning\n"); //Never stop learning
printf("Food\rGuard");//\r-> carriage return ==>Good
return 0;
}
Structure of C programming Language
Declaration and Initialization:
int a,b,c=10;
int a=2,b;
if(pf)
for
//#include <stdio.h> //printf and scanf
#include"stdio.h"//userdefined modification
int main()
{
// int a=7;
// int a='c';//a=99
int a=printf("Learn with Durga\n");//Learn with Durga
printf("%d",a);//a=?
return 0;
}
2.
#include<stdio.h>//userdefined modification
int main()
{
int a=20;
printf("%d\n",a); //20
printf("%4d....\n",a); //__20
printf("%-4d....\n",a);//20__
printf("%6.5d....\n",a);//_00020
printf("%-6.5d....\n",a);//00020_
return 0;
}
Storage classes available in C:
#include <stdio.h>
int main()
{ auto int i=5;
{
auto int i=4;
printf("%d\t",i);
{
auto int i=3;
printf("%d\t",i);
}
printf("%d\t",i);
}
printf("%d",i);
return 0;
}
static:
#include <stdio.h>
int main()
{ static int a=4;
printf("%d\t",a--);//4 3 2 1
if(a>0)
main();
return 0;
}
extern:
#include <stdio.h>
int main()
{ extern int a;//a=9
printf("%d\t",a);//9
a=10;
printf("%d\t",a--);//10
printf("%d\t",a);//9
return 0;
}
a=9;
Classification of Datatype:
step 3: Instruction set
- A programming language is an instruction set written machine understandable language that instructs computer to do the desired task.
- A programmer writes source code text in the programming language to create programs. It is used to make all the computer programs and computer software to control the assign task in certain procedure.
- For example: Binary language, Assembly language, B, PASCAL, GOBAL, C, C++, C#, JAVA, Python, Go and etc.
Introduction to C language:
- C is a general-purpose high level language that was originally developed by Dennis Ritchie for the Unix operating system.
- It was first implemented on the Digital Equipment Corporation PDP-11 computer in 1972.
- It is an upgrade version of languages B and BCPL.
Steps to Learn Programming Language
//80% usually Means "excellent"
#include <stdio.h>
int main()
{ int n=80;
char ch='a';
printf("%d%% usually\n Means \?excellent\?\v",n);
printf("Learn\t with durga\v");//Learn with durga
printf("Never stop learning\n"); //Never stop learning
printf("Food\rGuard");//\r-> carriage return ==>Good
return 0;
}
Declaration and Initialization:
int a,b,c=10;
int a=2,b;
if(pf)
for
//#include <stdio.h> //printf and scanf
#include"stdio.h"//userdefined modification
int main()
{
// int a=7;
// int a='c';//a=99
int a=printf("Learn with Durga\n");//Learn with Durga
printf("%d",a);//a=?
return 0;
}
#include<stdio.h>//userdefined modification
int main()
{
int a=20;
printf("%d\n",a); //20
printf("%4d....\n",a); //__20
printf("%-4d....\n",a);//20__
printf("%6.5d....\n",a);//_00020
printf("%-6.5d....\n",a);//00020_
return 0;
}
Storage classes available in C:
- auto
- extern
- static
- register
#include <stdio.h>
int main()
{ auto int i=5;
{
auto int i=4;
printf("%d\t",i);
{
auto int i=3;
printf("%d\t",i);
}
printf("%d\t",i);
}
printf("%d",i);
return 0;
}
static:
#include <stdio.h>
int main()
{ static int a=4;
printf("%d\t",a--);//4 3 2 1
if(a>0)
main();
return 0;
}
extern:
#include <stdio.h>
int main()
{ extern int a;//a=9
printf("%d\t",a);//9
a=10;
printf("%d\t",a--);//10
printf("%d\t",a);//9
return 0;
}
a=9;
Classification of Datatype:
- Primitive datatype - int,float, double and char
- User defined datatype - typedef and enum
- Derived datatype: primitive derived - array and user-defined derived - structure and union
step 3: Instruction set
- Decision making statement - if else and switch
- Looping statement - while, do while and for
No comments:
Post a Comment