PROGRAMMING SKILLS notes
PROGRAMMING SKILLS notes
SKILLS
BASIC ABOUT C PROGRAMS
• # Preprocessor directory
• Include add the header
• Stdio.h Standard Input Output . Header
printf( ), scanf( )
• conio.h Console Input Output . Header
clrscr( ) , getch( )
• Void main( ) void – datatype
main( ) – function
• Int a Declaration of variable
• Int a[2] 1D array
• %d Format specifier / Type specifier
• %d integer 2/4 byte
• %c character 1 byte
• %f float 4 byte
• Loop 2 types
i. Entry control loop:
for loop
while loop
ii. Exit control loop:
do…while loop
• Getch( ) Hold the output on screen
2 DIMENSIONAL CHARACTER ARRAY
• If we want to enter a list of student’s name in which a sequence of character
is a name of single student and we need(list) array which can store name of
more than one student than we have to use multi-dimensional character
array.
• Declaring and Initializing 2D character array:
• Multi-dimensional array is an ARRAY OF CHARACTER array(array of string)
which can be better understood using following example.
• Ex: char name[3][10];
• In above example first subscript value [3] which means this variable can store
name of 3 students each name can have maximum length of [10] character.
• We will understood this using following:
• Ex: char name[3][10];
• In the above example first subscript value [3] which means this variable can store
name of 3 students , each can have length of [10] character.
• We will understood this using following tabular format.
• Char name[3][10]= {“Aryan” , “Meshvi” , “Shloka”};
A R Y A N \0
M E S H V I \0
S H L O K A \0
• NOTE: Here ‘\0’ is a backslash character constant which denotes end of string at
particular row.
#include<stdip.h>
#inlude<conio.h>
printf(“\n”);
void main()
}
{