MODULE-I
MODULE-I
MODULE-I
Introduction: Data Structures, Classifications (Primitive & Non Primitive), Data structure Operations, Review of Arrays, Structures,
Self Referential Structures, and Unions. Pointers and Dynamic Memory Allocation Functions. Representation of Linear Arrays in
Memory, Dynamically allocated arrays, Array Operations: Traversing, inserting, deleting, searching, and sorting. Multi-dimensional
Arrays, Polynomials and Sparse Matrices. Strings: Basic Terminology, Storing, Operations and Pattern Matching algorithms.
Programming Examples.
Introduction
In computer science, several data structures are known depending on area of applications. Of them, few data structures are there which
are frequently used almost in all application areas and with the help of which almost all complex data structure can be conducted.
These data structures are known as fundamental data structures or classic data structures.
A data structure is a scheme for organizing data in the memory of a computer. Some of the more commonly used data structures
include lists, arrays, stacks, queues, heaps, trees, and graphs.
The way in which the data is organized affects the performance of a program for different tasks. Computer programmers decide which
data structures to use based on the nature of the data and the processes that need to be performed on that data.
Definition:
A data structure is a specialized format for organizing and storing data. General data structure types include the array, the file, the
record, the table, the tree, and so on.
Example: A Queue
A queue is an example of commonly used simple data structure. A queue has beginning and end, called the front and back of the
queue.
Data enters the queue at one end and leaves at the other. Because of this, data exits the queue in the same order in which it enters the
queue, like people in a checkout line at a supermarket.
Example: A Binary Tree
A binary tree is another commonly used data structure. It is organized like an upside down tree. Each spot on the tree, called a node,
holds an item of data along with a left pointer and a right pointer.
S.TAMILARASAN Page 1
DATA STRUCTURES AND APPLICATIONS
The pointers are lined up so that the structure forms the upside down tree, with a single node at the top, called the root node, and
branches increasing on the left and right as you go down the tree.
Data Structures in Alice
Alice has two built-in data structures that can be used to organize data, or to create other data structures:
• Lists
• Arrays
Lists
A list is an ordered set of data. It is often used to store objects that are to be processed sequentially. A list can be used
to create a queue.
Arrays
An array is an indexed set of variables, such as dancer [1], dancer [2], dancer [3]… It is like a set of boxes that hold things.
A list is a set of items. An array is a set of variables that each stores an item.
Classifications (Primitive & Non Primitive)
The figure shows types of classical data structure
S.TAMILARASAN Page 2
DATA STRUCTURES AND APPLICATIONS
Primitive Data Structures are the basic data structures that directly operate upon the machine instructions .they have different
representations on different computers. Integers, Floating point numbers, Character constants, String constants and Pointers come
under this category.
Non-primitive Data Structures
Non-primitive data structures are more complicated data structures and are derived from primitive data structures. They emphasize on
grouping same or different data items with relationship between each data item. Arrays, Lists and Files come under this category.
Linear Data Structure:
A data structure is said to be linear if its elements form a sequence. The elements of linear data structure represent by means of
sequential memory locations. The other way is to have the linear relationship between the elements represented by means of pointers
or links.
Example: Array and Linked List.
Non-linear data structure:
A data structure is said to be non-linear if its elements show a hierarchical relationship between each other. All elements assign the
memory as random form and you can fetch data elements through random access process.
Example: Trees and Graphs.
S.TAMILARASAN Page 3
DATA STRUCTURES AND APPLICATIONS
Multi-dimensional array
Two dimensional array
Three dimensional arrays, four dimensional array etc…
Single dimensional or one dimensional array
A one-dimensional array is a list of related variables. The general form of a one-dimensional array declaration is:
type array-Name [ array-Size ];
where type can be any valid C data type and The array-Size must be an integer constant greater than zero
Example:
int sample[10];
float numbers[100];
char name[40];
Storing Values in Arrays
The values can be stored in array using following three methods:
Initialization
Assigning values
Input values from keyboard
Initialization of One-Dimensional Array
Syntax:
<data_type> <array_name> [array_size] = {v1, v2, v3}; where v1, v2, v3 are values.
Example:
int num[5]={2,4,34,3,4};
The above code can be pictorially represented as shown below:
Example program
#include<stdio.h>
Void main ()
{
int num[5]={2,4,34,3,4};
clrscr();
printf("Value in array num[0] : %d \n", num[0]);
printf("Value in array num[1] : %d \n", num[1]);
printf("Value in array num[2] : %d \n", num[2]);
printf("Value in array num[3] : %d \n", num[3]);
printf("Value in array num[4] : %d ",num[4]);
getch();
}
S.TAMILARASAN Page 4
DATA STRUCTURES AND APPLICATIONS
S.TAMILARASAN Page 5
DATA STRUCTURES AND APPLICATIONS
for(i=0;i<5;i++)
{
printf("%d", num[i]);
}
Example Program
#include<stdio.h>
void main()
{
int num[5], i;
printf("enter 5 numbers:\n”);
for(i=0;i<5;i++)
{
scanf("%d", &num[i]);
}
for(i=0;i<5;i++)
{
printf("Value in array num[%d] : %d \n ", i, num[i]);
}
}
Structures
Definition:
A Structure is a user defined data type that can store related information together under a single name.
Basics of Structures
It is declared using a keyword struct followed by the name of the structure. The variables of the structure are declared within the
structure.
Syntax
struct structure_name
{
data_type member1;
data_type member2;
data_type member3;
};
The variables that are used to store the data are called members of the structure.
Example:
struct person
{
char name [50];
int cit_no;
float salary;
};
Structure variable Declaration
A structure can be declared using 2 methods:
S.TAMILARASAN Page 6
DATA STRUCTURES AND APPLICATIONS
Tagged Structure
When a structure is defined, it creates a user-defined type but, no storage is allocated.
Example:
struct person
{
char name [50];
int cit_no;
float salary;
};
void main ()
{
struct person p1, p2;
}
The variables p1 and p2 are variables of type struct person.
Once the structure variable is declared, the compiler allocates memory for the structure variables.
The size of the memory allocated is the sum of size of individual members.
Type definition
We can create structure variable using the keyword typedef
typedef struct person
{
char name [50];
int cit_no;
float salary;
} EMP;
void main ()
{
EMP p1, p2;
}
The variables p1 and p2 are the variables of type EMP
Structure Variable Initialization
struct person
{
char name [50];
int cit_no;
float salary;
};
struct person p1= {"ram", 24, 23000};
Structure within structure in C using pointer variable:
This program explains how to use structure within structure in C using pointer variable. “student_college_detail’ structure is
declared inside “student_detail” structure in this program. One normal structure variable and one pointer structure variable is used
S.TAMILARASAN Page 7
DATA STRUCTURES AND APPLICATIONS
in this program.
Please note that combination of. (dot) and -> (arrow) operators are used to access the structure member which is declared inside the
structure.
Example:
Self-Referential Structures
A self-referential structure is one in which one or more of its components are a pointer to itself.
These require dynamic storage management functions
typedef struct
{
S.TAMILARASAN Page 8
DATA STRUCTURES AND APPLICATIONS
char data;
struct list *link; //list is a pointer to a list structure
}list;
Consider three structures and values assigned to their respective fields
list item1,item2,item3;
item1.data='a';
item2.data='b';
item3.data='c';
item1.link=item2.link=item3.link=NULL;
We can attach these structures together as follows:
item1.link=&item2;
tem2.link=&item3;
Array of Structure
A structure is a group of related different data type variables. Sometimes we need multiple variables of structure for that we can
use the array of structure.
For example we have structure of student. We want the list of students of entire class but one variable of structure can be
representing only one student. So, to represent entire class variable we have to use array of student structure.
We can declare the array of structure as simply as other data type array. And same way to other data type we can use this
variable with the subscript.
struct arrayname [size];
Unions
S.TAMILARASAN Page 9
DATA STRUCTURES AND APPLICATIONS
A union is like a structure in which all members are stored at the same address. Members of a union can only be accessed one at a
time. The union data type was invented to prevent memory fragmentation. The union data type prevents fragmentation by creating
a standard size for certain data. Just like with structures, the members of unions can be accessed with the dot (.) and arrow (->)
operators. Take a look at this example:
#include<stdio.h> typedef union myunion
{
double PI; int B;
}MYUNION; int main()
{
MYUNION numbers; numbers.PI = 3.14; numbers.B = 50;
return 0;
}
If you would want to print the values of PI and B, only B value will be printed properly since single memory is reserved to hold the
data members’ value of union. Hence, 50 will be displayed correctly.
Differences between structures and unions
ber
S.TAMILARASAN Page 10
DATA STRUCTURES AND APPLICATIONS
S.TAMILARASAN Page 11
DATA STRUCTURES AND APPLICATIONS
Example:
P = &c
The statement assigns the address of c to the variable p, and p is said to ``point to'' c. The “&” operator only applies to
objects in memory: variables and array elements. It cannot be applied to expressions, constants, or register variables.
The unary operator * is the indirection or dereferencing operator; when applied to a pointer, it accesses the object the
pointer points to. Suppose that x and y is integers and ip is a pointer to int. This artificial sequence shows how to declare a
pointer and how to use &and *:
int x = 1, y = 2, z[10];
int *ip; /* ip is a pointer to int */
ip = &x; /* ip now points to x */
y = *ip; /* y is now 1 */
*ip = 0; /* x is now 0 */
ip = &z[0]; /* ip now points to z[0] */
Example Program
#include<stdio.h>
Void main()
{
int var1;
char var2;
printf(“\n Address of var1 variable: %d\n”, &var1);
printf(“\n Address of var2 variable: %d\n”, &var2);
return 0;
}
Output
Address of var1 variable: 1266
Address of var2 variable: 1268
Example
#include<stdio.h>
void main
{
int *pc; int c; c=22;
printf(“\n Value of c: %d\n”, c);
pc=&c;
printf(“\n Address of pointer pc: %d\n”,pc);
printf(“\n "Content of pointer pc: %d",*pc)
}
S.TAMILARASAN Page 12
DATA STRUCTURES AND APPLICATIONS
Output:
Address of c: 1232
Value of c: 22
Address of pointer pc: 1232
Content of pointer pc: 22
S.TAMILARASAN Page 13
DATA STRUCTURES AND APPLICATIONS
Example:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num, i, *ptr, sum = 0;
printf("Enter number of elements: ");
scanf("%d", &num);
S.TAMILARASAN Page 14
DATA STRUCTURES AND APPLICATIONS
S.TAMILARASAN Page 15
DATA STRUCTURES AND APPLICATIONS
#include<stdio.h>
#include<stdlib.h>
int a[20],b[20],c[40];
int m,n,p,val,i,j,key,pos,temp;
/*Function Prototype*/
void create();
void display();
void insert();
void del();
void search();
void merge();
void sort();
int main()
{
int choice;
do{
printf("\n\n--------Menu-----------\n");
printf("1.Create\n");
printf("2.Display\n");
printf("3.Insert\n");
printf("4.Delete\n");
printf("5.Search\n");
printf("6.Sort\n");
S.TAMILARASAN Page 16
DATA STRUCTURES AND APPLICATIONS
printf("7.Merge\n");
printf("8.Exit\n");
printf("-----------------------");
printf("\nEnter your choice:\t");
scanf("%d",&choice);
switch(choice)
{
case 1: create();
break;
case 2:
display();
break;
case 3:
insert();
break;
case 4:
del();
break;
case 5:
search();
break;
case 6:
sort();
break;
case 7:
merge();
break;
case 8:
exit(0);
break;
default:
printf("\nInvalid choice:\n");
break;
}
}while(choice!=8);
return 0;
}
S.TAMILARASAN Page 17
DATA STRUCTURES AND APPLICATIONS
S.TAMILARASAN Page 18
DATA STRUCTURES AND APPLICATIONS
for(i=pos;i<n-1;i++)
{
a[i]=a[i+1];
}
n=n-1;
printf("\nThe deleted element is =%d",val);
}//end of delete()
void search() //searching an array element
{
printf("\nEnter the element to be searched:\t");
scanf("%d",&key);
for(i=0;i<n;i++)
{
if(a[i]==key)
{
printf("\nThe element is present at position %d",i);
break;
}
}
if(i==n)
{
printf("\nThe search is unsuccessful");
}
}//end of serach()
void sort() //sorting the array elements
{
for(i=0;i<n-1;i++)
{
for(j=0;j<n-1-i;j++) { if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
printf("\nAfter sorting the array elements are:\n");
display();
S.TAMILARASAN Page 19
DATA STRUCTURES AND APPLICATIONS
}//end of sort
void merge() //merging two arrays
{
printf("\nEnter the size of the second array:\t");
scanf("%d",&m);
printf("\nEnter the elements for the second array:\n");
for(i=0;i<m;i++)
{
scanf("%d",&b[i]);
}
for(i=0,j=0;i<n;i++,j++)
{
c[j]=a[i];
}
for(i=0;i<m;i++,j++)
{
c[j]=b[i];
}
p=n+m;
printf("\nArray elements after merging:\n");
for(i=0;i<p;i++)
{
printf("%d\t",c[i]);
}
}//end of merge()
Multidimensional Arrays
Array having more than one subscript variable is called Multi-Dimensional array. Multi-Dimensional Array is also called as
Matrix.
A two dimensional array is used when elements are arranged in a tabular fashion.
Syntax:
<data-type> <array_name> [row_subscript][column-subscript];
Example:
int matrix[2][3];
Pictorially Representation
S.TAMILARASAN Page 20
DATA STRUCTURES AND APPLICATIONS
Example:
int matrix[2][3]= {1, 23, 11, 44, 5, 6};
{
Scanf(“%d”, &matrix[1][j]);
}
}
printf("elements of the matrix are: \n”);
for(i=0; i<2; i++)
{
for (j=0; j<3; j++)
{
printf(“%d\t”, &matrix[1][j]);
}
Printf(“\n”);
}
}
Polynomials
Polynomials come under the section Algebra in Mathematics. A polynomial is an expression of finite length constructed from
variables, constants and non-negative integer exponents. The operations addition, subtraction and multiplication determine its entire
structure. Polynomials are used in a wide variety of problems where they are called as polynomial equations.
An example of a polynomial is 3x2+2x+7; here, the total number of terms is 3. The coefficients of each term are 3, 2, 7 and degrees 2,
1, 0 respectively.
While adding two polynomials, following cases need to be considered.
When the degrees of corresponding terms of the two polynomials are same:
This is the normal case when corresponding coefficients of each term can be added directly. For example, the sum of the polynomials
5x3+2x2+7
7x3+9x2+12
-------------------
12x3+11x2+19
---------------------- is a simple addition where all the degrees of the corresponding terms are same. 2. When the degrees of
corresponding terms of the polynomials are different:
Here, the term with the larger degree pre-dominates.
9x4+5x3+ +2x
3x4+ +4x2+7x
------------------------
12x4+5x3+4x2+9x
---------------------------
Program to find the value of the polynomial f(x)=a4x4+a3x3+a2x2+a1x+a0 using Horner’s method
#include "stdio.h"
#include "conio.h"
void main()
S.TAMILARASAN Page 22
DATA STRUCTURES AND APPLICATIONS
{
float a[100],sum=0,x;
int n,i;
clrscr();
printf("Enter the degree of the polynomial:");
scanf("%d",&n);
printf("Enter the coefficients into the array:");
for(i=n;i>=0;i--)
{
scanf("%f",&a[i]);
}
printf("Enter the value of x:");
scanf("%f",&x);
for(i=n;i>0;i--)
{
sum=(sum+a[i])*x;
}
sum=sum+a[0];
printf("\nValue of the polynomial is =%f",sum);
getch();
}
Output
Enter the degree of the polynomial:
4
Enter the coefficients into the array:
3
2
1
1
2
Enter the value of x:
2
Value of the polynomial is:72.000000
This C Program evaluates the given polynomial equation. The polynomial equation formula is P(x)=AnXn + An-1Xn-1 + An-
2Xn-2+… +A1X + A0.
1. /*
2. * C program to evaluate a given polynomial by reading its coefficients
3. * in an array.
4. * P(x) = AnXn + An-1Xn-1 + An-2Xn-2+... +A1X + A0
S.TAMILARASAN Page 23
DATA STRUCTURES AND APPLICATIONS
5. *
6. * The polynomial can be written as:
7. * P(x) = A0 + X(A1 + X(A2 + X(A3 + X(Q4 + X(...X(An-1 + XAn))))
8. * and evaluated starting from the inner loop
9. */
10. #include <stdio.h>
11. #include <stdlib.h>
12. #define MAXSIZE 10
13.
14. void main()
15. {
16. int array[MAXSIZE];
17. int i, num, power;
18. float x, polySum;
19.
20. printf("Enter the order of the polynomial \n");
21. scanf("%d", &num);
22. printf("Enter the value of x \n");
23. scanf("%f", &x);
24. /* Read the coefficients into an array */
25. printf("Enter %d coefficients \n", num + 1);
26. for (i = 0; i <= num; i++)
27. {
28. scanf("%d", &array[i]);
29. }
30. polySum = array[0];
31. for (i = 1; i <= num; i++)
32. {
33. polySum = polySum * x + array[i];
34. }
35. power = num;
36.
37. printf("Given polynomial is: \n");
38. for (i = 0; i <= num; i++)
39. {
40. if (power < 0)
41. {
42. break;
43. }
44. /* printing proper polynomial function */
45. if (array[i] > 0)
46. printf(" + ");
47. else if (array[i] < 0)
48. printf(" - ");
49. else
50. printf(" ");
51. printf("%dx^%d ", abs(array[i]), power--);
52. }
S.TAMILARASAN Page 24
DATA STRUCTURES AND APPLICATIONS
S.TAMILARASAN Page 25
DATA STRUCTURES AND APPLICATIONS
Transposing a matrix
To transpose a matrix we must interchange the rows and columns. This means that each element a[i][j] in the original matrix becomes
element b[j][i] in the transpose matrix.
Program
#define MAX 20
int main()
{
int a[10][10], b[MAX][3], row, column;
printf("\nEnter the size of matrix (rows, columns): ");
scanf("%d%d", &row, &column);
S.TAMILARASAN Page 26
DATA STRUCTURES AND APPLICATIONS
S.TAMILARASAN Page 27
DATA STRUCTURES AND APPLICATIONS
}
}
character t w o \0
ASCII 116 119 41 0
Syntax:
char str[size];
Initialization of String
Example:
char s[5]={'r', 'a', 'm', 'a' };
char s[9]="rama";
The above code can be pictorially represented as shown below:
s[0] s[1] s[2] s[3] s[4]
r a m a \0
S.TAMILARASAN Page 28
DATA STRUCTURES AND APPLICATIONS
Example Program:
#include<stdio.h>
void main()
{
char s[5]={'r','a','m','a'}; //or char s[5]="rama";
printf("Value in array s[0] : %c \n", s[0]);
printf("Value in array s[1] : %c \n", s[1]);
printf("Value in array s[2] : %c \n", s[2]);
printf("Value in array s[3] : %c\n ", s[3]);
}
The strings can be read from the keyboard and can be displayed onto the monitor using following two formatted functions:
Formatted input function: scanf()
Formatted output function: printf()
Example Program
#include<stdio.h>
void main()
{
char name[10];
printf(“Enter your name: \n”);
scanf(“%s”, name);
printf(“welcome: ”);
printf(“%s”, name);
}
S.TAMILARASAN Page 29
DATA STRUCTURES AND APPLICATIONS
strlen()
This function calculates the length of string. It takes only one argument, i.e., string-name. (OR)
It is used to return the length of a string.
syntax
temp_variable = strlen (string_name);
Example program
#include<string.h>
#include<stdio.h>
void main()
{
char c[20];
int len;
printf("Enter string whose length is to be found:");
gets(c);
len=strlen(c);
printf("\n Length of the string :=%d ", len);
}
strcpy()
This function copies the content of one string to the content of another string. It takes 2 arguments. (OR)
It is used to copy one string to another string. The content of the second string is copied to the content of the first string.
syntax
strcpy(destination, source);
Where source and destination are both the name of the string.
Example Program
#include<string.h>
#include<stdio.h>
void main()
{
• char src[20],dest[20];
• printf("Enter string: ");
• gets(src);
• strcpy(dest, src); //Content of string src is copied to string dest
• printf("Copied string: ");
• puts(dest);
}
strcat()
It is used to concatenate i.e., combine the content of two strings. (OR)
S.TAMILARASAN Page 30
DATA STRUCTURES AND APPLICATIONS
This function joins 2 strings. It takes two arguments, i.e., 2 strings and resultant string is stored in the first string
specified in the argument.
Syntax:
o strcat(first_string,second_string);
Example Program:
#include<stdio.h>
#include<string.h>
void main()
{
char str1[10], str2[10};
printf("Enter First String:");
gets(str1);
printf(“Enter Second String:”);
gets(str2);
printf("\n Enter Second String:");
gets(str2);
strcat(str1,str2); //concatenates str1 and str2 and
printf("\n Concatenated String is:= ");
puts(str1); //resultant string is stored in str1
}
strcmp()
This function compares 2 string and returns value 0, if the 2 strings are equal. It takes 2 arguments, i.e., name of two strings to
compare.(OR)
It is used to compare the contents of the two strings. If any mismatch occurs then it results the difference of ASCII
values between the first occurrences of 2 different characters.
Syntax:
strcmp(string 1, string 2);
Example Program:
#include <string.h>
#include<stdio.h>
void main()
{
char str1[30],str2[30];
printf("Enter first string: ");
gets(str1);
printf ("Enter second string: ");
gets(str2);
if(strcmp(str1,str2)==0)
printf("Both strings are equal");
else
printf("Strings are unequal");
S.TAMILARASAN Page 31
DATA STRUCTURES AND APPLICATIONS
}
Pattern Matching
String matching is a most important problem.
String matching consists of searching a query string (or pattern) P in a given text T.
Generally the size of the pattern to be searched is smaller than the given text.
There may be more than one occurrences of the pattern P in the text T. Sometimes we have to find all the occurrences of the pattern
in the text.
There are several applications of the string matching. Some of these are
Text editors
Search engines
Biological applications
Since string-matching algorithms are used extensively, these should be efficient in terms of time and space.
Let P [1..m] is the pattern to be searched and its size is m.
T [1..n] is the given text whose size is n
Assume that the pattern occurs in T at position (or shift) i. Then the output of the matching algorithm will be the integer i where 1
<= i <= n-m. If there are multiple occurrences of the pattern in the text, then sometimes it is required to output all the shifts where
the pattern occurs.
S.TAMILARASAN Page 32
DATA STRUCTURES AND APPLICATIONS
1. i = 1; [ substring 1]
2. Repeat steps 3 to 5 while i <=n-m+1 do
3. for j= 1 to m [For each character of P]
S.TAMILARASAN Page 33
DATA STRUCTURES AND APPLICATIONS
void read()
{
printf("\nEnter a string \n");
gets(Mainstr);
printf("\nEnter a search string \n");
flushall();
gets(Pat);
printf("\nEnter a replace string \n");
flushall();
gets(Replace);
}
void find_replace()
{
i = m = c = j = 0;
while ( Mainstr[c] != '\0')
{
if ( Mainstr[m] == Pat[i] ) // ...... matching
{
i++;
m++;
if ( Pat[i] == '\0') //.....found occ
{
//.... copy replace string in ans string .....
for(k=0; Replace[k] != '\0';k++,j++) {
ans[j] = Replace[k];}
i=0;
c=m;
}
}
else //... mismatch
{
ans[j] = Mainstr[c];
j++;
c++;
m = c;
i=0;
}
}
ans[j] = '\0';
printf("\nThe resultant string is\n%s" ,ans);
}
void main()
{
clrscr();
read();
find_replace();
getch();
S.TAMILARASAN Page 34
DATA STRUCTURES AND APPLICATIONS
/* Output
Enter a string
Respected Sir
Enter a search string
Respected
Enter a replace string
Dear
The resultant string is
Dear Sir
S.TAMILARASAN Page 35
DATA STRUCTURES AND APPLICATIONS
Model Questions
1. What do you mean by Data Structure? What are the various operations performed on data structures? Explain
2. What are the various types of data structures? Brief with an example
3. Differentiate between linear and non – linear data structures
4. Declare and use a data structure in C for maintaining student details
5. Explain declaring pointer to structure with an example
6. How do we access data members of structure and structure with a pointer? Examples?
7. Define Unions with an example
8. Compare structures and unions with an example
9. What are the advantages of using unions?
10. What do you mean by self-referential structures? Explain with an example
11. What is a sparse matrix? Brief it with an example
12. Write a C program to check whether input matrix is a sparse or not
13. What are polynomials? Brief it with an example
14. Write a C program to add two polynomials
15. Define Array. Explain how one – dimensional arrays are declared and initialized with an example
16. Explain how one – dimensional arrays are declared and initialized with an example
17. Write a C program to perform basic operations on single dimensional array
18. Differentiate between array and a structure
19. Compare Single and Multi – Dimensional arrays
20. List some of the applications of arrays
21. Define String. Explain how a string can be declared and initialized with an example
22. List different string manipulation functions. Explain them along with syntax
23. Illustrate string manipulation functions with examples
24. What do you mean by dynamic memory allocation? Explain various functions under it
S.TAMILARASAN Page 36