BCA 1ST YEAR PRACTICE NOTES
PROJECT 1
1ST CODE
1. #include<stdio.h>
2. intmain(){
3. printf(“hello world”);
4. return 0;
5. }
CHAPTER –1
VARIABLES
KEYWORDS
CONSTANT
COMMENTS
STRUCTURE
COMILATI
1. Variables:- It Is name of a memory location which stores some data.
Rules:- 1. Variables are case sensitive. ( a and A are different )
2, 1st character is alphabet or ‘_’.
3, No comma and blank space.
4, No other symbol other than “_”.
Data Types :-
Types Size in bytes
Char and signed char 1
Unsigned char 1
Int or signed int 2
Short int or unsigned short int 2
Signed short int 2
Long int or signed long int 2
Unsigned long int 4
BCA 1ST YEAR PRACTICE NOTES
Unsigned int 4
4
Double 8
Long double 10
Float 4
(INTEGER)
1. Data types = int ( it can be a whole no.).
2. Float = decimal no.
3. Char = (!,@,#,$,%,^,&).
Constant :- value that don’t change.(fixed value)
Types:-
1. Integer constant :- 1,0,-1.
2. Real constant :- 1.0,2.0,3.0.
3. Character constant:- a,b,A,F,#,$,%.
Keywords:-reserved words that have sepecial meaning to the compilar.
auto double int struct
break else long switch
case enum register typedef
character extern return union
continue for signed void
do if static while
default goto sizeof volatile
const float short unsigned
Comment:- line that are not pard of programe.
[Link] line =//
2. multi line = /*,/*
BCA 1ST YEAR PRACTICE NOTES
Out put:-
Printf(“hello wolrd’);
For a new line
Scanf(“…….”); ( for next line).
Output cases:-
1. Integers=
Printf(“age is %d”, age); d is double value.
2. Real number=
Printf(“value of pi is %f”, pi);
3. Char -=
Printf(“star look like this %c”, star);
Input:-
Scanf(“%d”,&age);
(Project 2)
1. #include<stdio.h>
2. intmain(){
3. Int age;
4. printf(“enter age”);
5. Scanf(“%d”,&age);
6. Printf(“age is %d”,age);
7. return 0;
8. }
Compilation:- a computer program that translate c code into machine
code.
BCA 1ST YEAR PRACTICE NOTES