Home » » Basic Programming in C Language with Example

Basic Programming in C Language with Example


Basic Programming in C Language with Example


Basic Programming in C Language with Example


     1. C is developed by Dennis Richie at 1972 at Bell Laboratories in U.S.A.
     2. C is a middle level language.
     3. STDIO = Standard input and ouput 
     4. STDIO = It is used for the printf and scanf.
     5. printf  = output statement
     6. scanf = input statement
     7. conio = It is used for clrscr and getch
     8. clrscr = It is used for clear the previous output.
     9. getch = It is used for show the ouput screen.
     10. H = Header files
     11. Alt+F9 = To compile the C program.
     12. ctrl+F9 = To run the C program.

Comment

     It has two types

1. Single line comment = It will not execute one single line symbol - //

2. Multi line comment = It will not execute more than one line symbol - /*...*/


Single Line Comment
Input:


#include
#include
void main()
{
clrscr();
//printf("arun");
printf("kumar");
printf("selva");
getch();
}

Output:

kumarselva

Multi Line Comment
Input:
#include
#include
void main()
{
clrscr();
/*printf("arun");
printf("kumar")*/
printf("selva");
getch();
}
output:

selva

Escape Sequences

     \n - new lines
     \t  - horizontal tab
     \b - backspace
     \r - carriage return
     \a - bell sound
     \\ - backslash
     \? - question mark
     \' - single quotes
     \'' - double quotes

Input:


#include
#include
void main()
{
clrscr();
printf("\n\tar \bun");
printf("\n\tkum \bar");
printf("\n\t\t\t sel \bva");
getch();
}

Output:


arun
kumar
selva

Carriage Return
Input:


#include
#include
void main()
{
clrscr();
printf("\narun \rkumar");
getch();
}

Output:


kumar

0 coment�rios:

Post a Comment

Link you don't want to vouch for Read more: https://html.com/seo/#ixzz5zVltiZ5g