0% found this document useful (0 votes)
3 views

PROGRAMMING SKILLS notes

The document provides a basic overview of C programming concepts, including preprocessor directives, standard input/output functions, variable declarations, and format specifiers. It also explains the use of one-dimensional and two-dimensional character arrays for storing strings, specifically for entering student names. Additionally, it includes sample code demonstrating the initialization and input of a 2D character array.

Uploaded by

meshvipatel15
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

PROGRAMMING SKILLS notes

The document provides a basic overview of C programming concepts, including preprocessor directives, standard input/output functions, variable declarations, and format specifiers. It also explains the use of one-dimensional and two-dimensional character arrays for storing strings, specifically for entering student names. Additionally, it includes sample code demonstrating the initialization and input of a 2D character array.

Uploaded by

meshvipatel15
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

PROGRAMMING

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()
}
{

char temp[3][10]; getch();


int I , j ; }
clrscr();
for (i=0; i<3 ; i++)
{
printf(“\n Enter value for string %d:”,i);
scanf(“%s”,&temp[i][0]);
}
printf(“\n string entered by user are :\n);
for( i=0; I <3 ; i ++)
{
for(j=0;j<10; j ++)
{
if(temp[i][j]==‘\0\)
{
break;

You might also like