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();
}
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.
Literals
#include<stdio.h>
#include<conio.h>
void main(){
int x=5;
float v=5.98;
clrscr();
printf("feel_the_coder"); // string literal
printf("%d",x); //integer literal
printf("%f",v); // floating literal
getch();
Trigraph Characters
??=include<stdio.h>
void main()
??<
printf("feel_the_coder");
??>
Comments
Post a Comment