SlideShare a Scribd company logo
WELCOME TO OUR
PRESENTATION
• GROUP MEMBERS:
• 1.MINHAZUR RAHMAN .ID:161-15-7281.
• 2.MD.IMRAN HOSSAIN.ID:161-15-7358.
• 3.MD.HANIF SAGOR.ID:161-15-7162.
• 4. BITHI.ID:161-15-7116
TODAY OUR TOPIC IS
->ARRAY
->FUNCTION
->POINTER
->STRUCTURE
Introduction
One-dimensional array
Multidimensional array
Array
Introduction
• It holds multiple values of same type.
• Each block of array is stored consecutively in memory.
SYNTAX:
data-type name[size1][size2]………[sizen];
Example:
int a[6];
Advantage of Array
• Huge amount of data can be stored under single variable name.
• Searching of data item is faster.
• 2 dimension arrays are used to represent the matrices.
• It is helpful in implementing other data structure like linked list,
queue,stack.
One dimensional Array
SYNTAX:
data-type name[index];
EXAMPLE:
int num[10];
Initialization
• int num[6]={2,4,6,7,8,12};
• Individual elements can also be initialize as:
• num[0]=2;
• num[1]=4;
• num[2]=6;
• num[3]=7;
• num[4]=8;
• num[5]=12;
•
#include<stdio.h>
void main()
{ int n,i,arr[5];
printf("Enter the value of n:");
scanf("%d",&n);
for(i=0; i<n; i++)
{
printf("input value:");
scanf("%d",&arr[i]);
}
printf("inputted values are :n");
for(i=0; i<n; i++)
{
printf("n%d",arr[i]);
}
}
Multi-dimensional Array
• In multi-dimensional we focus on the two dimensional array.
SYNTAX:
data-type name[row-size][column-size];
EXAMPLE:
int a[3][4];
Initialization
• int odd[3][2]={1,3,5,7,9,11};
• Individual element can also be assigned as:
• Odd[0][0]=1;
• Odd[0][1]=3;
• Odd[1][0]=5;
• Odd[1][1]=7;
• Odd[2][0]=9;
• Odd[2][1]=11;
• #include<stdio.h>
void main()
{
int n,i,j,arr[5][5];
printf("Enter the value of n:");
scanf("%d",&n);
for(i=0; i<n; i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&arr[i][j]);
}
}
printf("inputted values are :n");
for(i=0; i<n; i++)
{
for(j=0;j<n;j++)
{
printf("n%d",arr[i][j]);
}
}
}
THANK YOU
Welcome to our_presentation in c
Welcome to our_presentation in c
Welcome to our_presentation in c
Welcome to our_presentation in c
Welcome to our_presentation in c
Welcome to our_presentation in c
Welcome to our_presentation in c
Welcome to our_presentation in c
Welcome to our_presentation in c
Programming in C
Pointer Basics
What Are Pointers?
A pointer is a variable whose value is the address of another variable,
i.e., direct address of the memory location
How to use Pointers?
• There are few important operations, which we will do
with the help of pointers very frequently. (a) we
define a pointer variable (b) assign the address of a
variable to a pointer and (c) finally access the value at
the address available in the pointer variable.
1/14/10
C Pointer Variables
To declare a pointer variable, we must do two things
– Use the “*” (star) character to indicate that the variable
being defined is a pointer type.
– Indicate the type of variable to which the pointer will
point (the pointee).
• General declaration of a pointer
type *nameOfPointer;
1/14/10
Pointer Declaration
The declaration
int *intPtr;
defines the variable intPtr to be a pointer to a variable of type int.
Caution -- Be careful when defining multiple variables on the same line.
In this definition
int *intPtr, intPtr2;
intPtr is a pointer to an int, but intPtr2 is not!
1/14/10
Pointer Operators
The two primary operators used with pointers are
* (star) and & (ampersand)
– The * operator is used to define pointer variables and
to deference a pointer.
– The & operator gives the address of a variable.
Recall the use of & in scanf( )
• #include<stdio.h>
void main(){
int a;
a=100;
int *p;
p=&a;
printf("The value of a :%d",a);
printf("The value of a :%d",*p);
printf("The address of a :%p",&a);
printf("The address of a :%p",p);
printf("The address of p :%p",&p);
}
Welcome to our_presentation in c
STRUCTURE IN C
WHAT IS STRUCTURE
• Structure is a user define data type.
• It is group of different types of data variables.
• Structure constitute a sort of super data type.
• The C keyword structure declares a c structure.
• Tag is an optional name of a structure type.
STRUCTURE EXAMPLE
#include <stdio.h>
struct student {
int roll;
char name [20];
}stu1={101,”Rahman”};
void main(){
struct student stu2;
printf(“Roll no:%d”,stu1.roll);
printf(“student name:%s”,stu1.name);
printf(“Enter roll no for 2nd student:”);
scanf(“%d”, & stu2.roll);
printf(“Enter name for 2nd student:”);
scanf(“%s”,, & stu2.name);
printf(“roll no2 : %d”, stu2.roll);
printf(“Name 2: %s”, stu2.name);
}
STRUCTURE DECLARATION
• struct tag_name
{
data type member1;
data type member2;
…
…
;
• Example:
Struct lib_books
{
Char title[20];
Char author[15];
Int pages;
Float price;
};
STRUCTURE DECLARATION (CONT.)
• The keyword structure declares a structure to holds the details of four fields namely
- title
- author
- Pages and
- Price.
• These are members of the structures.
• Each member may belong to different or same data type.
• The structure we just declared is not a variable by itself but a template for the structure.
STRUCTURE DECLARATION (CONT.)
• We can declare structure variables using the tag name any where any where in the program. For example
the statement,
struct lib_books book1,book2,book3;
• The complete structure declaration might look like this
struct lib_books
{
char title[20];
char author[15];
int pages;
float price;
};
struct lib_books book1,book2,book3;
STRUCTURE WITHIN STRUCTURE
#include<stdio.h>
struct date{
int day;
int month;
Int year;
};
struct student {
int id;
struct date birthday;
char name[20];
}
#include<stdio.h>
struct date{
int day;
int month;
Int year;
};
struct date{
int day;
int month;
int year;
}birthday;
char name[20];
}
STRUCTURE OVER ARRAY
• Array’s disadvantage is that all the elements stored in an array are to be of the same data type.
• If we need to use a collection of different data type items it is not possible using an array.
• We require using a collection of different data items of differnent data types we can use a structure.
ARRAY WITHIN STRUCTURE
• We often use array of structure
Example:
include<stdio.h>
struct student{
int roll;
int marks[5];
char name[10];
};
void main(){
struct student stu;
int i, sum=0;
printf(“Enter roll no:”);
scanf (“/n%d”, & stu.roll);
printf(“Enter name:/n”);
scanf(“%s”, & stu.name);
for(i=0; i<5; i++){
printf(“Enter marks %d”,i+1);
scanf(“%d”, & stu.mark[i]);
sum+=stu.mark[i];
}
printf(“student details:/n”);
printf(“name:%s”,stu.name);
printf(“/nroll:%d”,stu.roll);
printf(“/n total marks :%d”,sum);
}
ADVANTAGES AND DISADVANTAGES OF STRUCTURED PROGRAMMING
• The advantages of adopting a structured approach to programming are numerous.
• These include the following:
• The sequence of operations is simple to trace, thus facilitating debugging.
• There are a finite number of structures with standardized terminology.
• Structures lend themselves easily to building subroutines.
• The set of structures is complete; that is, a]1 programs can be written using three structures.
• Structures are self-documenting and, therefore, easy to read.
• Structures are easy to describe in flowcharts, syntax diagrams, pseudo code, and so on.
• Structured programming results in increased programmer productivity-programs can be written faster.
Welcome to our_presentation in c

More Related Content

PPTX
C programing -Structure
PPTX
Structures in c language
PPTX
arrays and pointers
PPTX
Array Of Pointers
PPTX
Structure in C
PPTX
2CPP06 - Arrays and Pointers
PPTX
Array in c language
PPTX
C programing -Structure
Structures in c language
arrays and pointers
Array Of Pointers
Structure in C
2CPP06 - Arrays and Pointers
Array in c language

What's hot (18)

PPTX
Presentation on c programing satcture
PPTX
Array in C
PPTX
Array in-c
PPTX
arrays of structures
PPTX
17 structure-and-union
PPTX
Array in c
PPTX
Unit 9. Structure and Unions
PPTX
Array in c language
PPTX
Basic array in c programming
PPTX
Array in c programming
PPTX
Array in (C) programing
PPT
Arrays Basics
PPTX
Introduction linked list
PPTX
Arrays in c language
PDF
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
PPT
C96e1 session3 c++
PPTX
C++ lecture 04
PPTX
Array C programming
Presentation on c programing satcture
Array in C
Array in-c
arrays of structures
17 structure-and-union
Array in c
Unit 9. Structure and Unions
Array in c language
Basic array in c programming
Array in c programming
Array in (C) programing
Arrays Basics
Introduction linked list
Arrays in c language
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
C96e1 session3 c++
C++ lecture 04
Array C programming
Ad

Similar to Welcome to our_presentation in c (20)

PPT
Introduction to structures in c lang.ppt
PPT
structures.ppt
PPTX
Unit-V.pptx
PPTX
Data Structures and Algorithms_Updated.pptx
PDF
Lk module4 structures
PPTX
795834179-DS-module-1.pptx for dta sffssystrseeg
PPT
C Language_PPS_3110003_unit 8ClassPPT.ppt
PPTX
User defined data types.pptx
PPTX
vkvkhkdflaksjdlfjalkjfaljklajskldjaklsjdklajsdkljaklsjdklajskdljaklsdjklaj
PDF
java.pdf
PPTX
Structures
DOCX
Structure and Typedef
PPTX
Address, Pointers, Arrays, and Structures2.pptx
PDF
Data Structure & Algorithm - Self Referential
PDF
DATA STRUCTURE ARRAY AND STRUCTURES CHAPTER 2
PDF
DATA STRUCTRES ARRAY AND STRUCTURES CHAPTER 2
PPTX
U5 SPC.pptx
DOCX
Str
PPTX
Coding - L30-L31-Array of structures.pptx
Introduction to structures in c lang.ppt
structures.ppt
Unit-V.pptx
Data Structures and Algorithms_Updated.pptx
Lk module4 structures
795834179-DS-module-1.pptx for dta sffssystrseeg
C Language_PPS_3110003_unit 8ClassPPT.ppt
User defined data types.pptx
vkvkhkdflaksjdlfjalkjfaljklajskldjaklsjdklajsdkljaklsjdklajskdljaklsdjklaj
java.pdf
Structures
Structure and Typedef
Address, Pointers, Arrays, and Structures2.pptx
Data Structure & Algorithm - Self Referential
DATA STRUCTURE ARRAY AND STRUCTURES CHAPTER 2
DATA STRUCTRES ARRAY AND STRUCTURES CHAPTER 2
U5 SPC.pptx
Str
Coding - L30-L31-Array of structures.pptx
Ad

Recently uploaded (20)

PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Basic Mud Logging Guide for educational purpose
PDF
RMMM.pdf make it easy to upload and study
PDF
Pre independence Education in Inndia.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Classroom Observation Tools for Teachers
PDF
Complications of Minimal Access Surgery at WLH
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Basic Mud Logging Guide for educational purpose
RMMM.pdf make it easy to upload and study
Pre independence Education in Inndia.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Classroom Observation Tools for Teachers
Complications of Minimal Access Surgery at WLH
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Final Presentation General Medicine 03-08-2024.pptx
VCE English Exam - Section C Student Revision Booklet
Sports Quiz easy sports quiz sports quiz
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
Microbial diseases, their pathogenesis and prophylaxis
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Anesthesia in Laparoscopic Surgery in India
102 student loan defaulters named and shamed – Is someone you know on the list?
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
human mycosis Human fungal infections are called human mycosis..pptx

Welcome to our_presentation in c

  • 2. • GROUP MEMBERS: • 1.MINHAZUR RAHMAN .ID:161-15-7281. • 2.MD.IMRAN HOSSAIN.ID:161-15-7358. • 3.MD.HANIF SAGOR.ID:161-15-7162. • 4. BITHI.ID:161-15-7116
  • 3. TODAY OUR TOPIC IS ->ARRAY ->FUNCTION ->POINTER ->STRUCTURE
  • 5. Introduction • It holds multiple values of same type. • Each block of array is stored consecutively in memory. SYNTAX: data-type name[size1][size2]………[sizen]; Example: int a[6];
  • 6. Advantage of Array • Huge amount of data can be stored under single variable name. • Searching of data item is faster. • 2 dimension arrays are used to represent the matrices. • It is helpful in implementing other data structure like linked list, queue,stack.
  • 7. One dimensional Array SYNTAX: data-type name[index]; EXAMPLE: int num[10];
  • 8. Initialization • int num[6]={2,4,6,7,8,12}; • Individual elements can also be initialize as: • num[0]=2; • num[1]=4; • num[2]=6; • num[3]=7; • num[4]=8; • num[5]=12;
  • 9. • #include<stdio.h> void main() { int n,i,arr[5]; printf("Enter the value of n:"); scanf("%d",&n); for(i=0; i<n; i++) { printf("input value:"); scanf("%d",&arr[i]); } printf("inputted values are :n"); for(i=0; i<n; i++) { printf("n%d",arr[i]); } }
  • 10. Multi-dimensional Array • In multi-dimensional we focus on the two dimensional array. SYNTAX: data-type name[row-size][column-size]; EXAMPLE: int a[3][4];
  • 11. Initialization • int odd[3][2]={1,3,5,7,9,11}; • Individual element can also be assigned as: • Odd[0][0]=1; • Odd[0][1]=3; • Odd[1][0]=5; • Odd[1][1]=7; • Odd[2][0]=9; • Odd[2][1]=11;
  • 12. • #include<stdio.h> void main() { int n,i,j,arr[5][5]; printf("Enter the value of n:"); scanf("%d",&n); for(i=0; i<n; i++) { for(j=0;j<n;j++) { scanf("%d",&arr[i][j]); } } printf("inputted values are :n"); for(i=0; i<n; i++) { for(j=0;j<n;j++) { printf("n%d",arr[i][j]); } } }
  • 24. What Are Pointers? A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location
  • 25. How to use Pointers? • There are few important operations, which we will do with the help of pointers very frequently. (a) we define a pointer variable (b) assign the address of a variable to a pointer and (c) finally access the value at the address available in the pointer variable.
  • 26. 1/14/10 C Pointer Variables To declare a pointer variable, we must do two things – Use the “*” (star) character to indicate that the variable being defined is a pointer type. – Indicate the type of variable to which the pointer will point (the pointee). • General declaration of a pointer type *nameOfPointer;
  • 27. 1/14/10 Pointer Declaration The declaration int *intPtr; defines the variable intPtr to be a pointer to a variable of type int. Caution -- Be careful when defining multiple variables on the same line. In this definition int *intPtr, intPtr2; intPtr is a pointer to an int, but intPtr2 is not!
  • 28. 1/14/10 Pointer Operators The two primary operators used with pointers are * (star) and & (ampersand) – The * operator is used to define pointer variables and to deference a pointer. – The & operator gives the address of a variable. Recall the use of & in scanf( )
  • 29. • #include<stdio.h> void main(){ int a; a=100; int *p; p=&a; printf("The value of a :%d",a); printf("The value of a :%d",*p); printf("The address of a :%p",&a); printf("The address of a :%p",p); printf("The address of p :%p",&p); }
  • 32. WHAT IS STRUCTURE • Structure is a user define data type. • It is group of different types of data variables. • Structure constitute a sort of super data type. • The C keyword structure declares a c structure. • Tag is an optional name of a structure type.
  • 33. STRUCTURE EXAMPLE #include <stdio.h> struct student { int roll; char name [20]; }stu1={101,”Rahman”}; void main(){ struct student stu2; printf(“Roll no:%d”,stu1.roll); printf(“student name:%s”,stu1.name); printf(“Enter roll no for 2nd student:”); scanf(“%d”, & stu2.roll); printf(“Enter name for 2nd student:”); scanf(“%s”,, & stu2.name); printf(“roll no2 : %d”, stu2.roll); printf(“Name 2: %s”, stu2.name); }
  • 34. STRUCTURE DECLARATION • struct tag_name { data type member1; data type member2; … … ; • Example: Struct lib_books { Char title[20]; Char author[15]; Int pages; Float price; };
  • 35. STRUCTURE DECLARATION (CONT.) • The keyword structure declares a structure to holds the details of four fields namely - title - author - Pages and - Price. • These are members of the structures. • Each member may belong to different or same data type. • The structure we just declared is not a variable by itself but a template for the structure.
  • 36. STRUCTURE DECLARATION (CONT.) • We can declare structure variables using the tag name any where any where in the program. For example the statement, struct lib_books book1,book2,book3; • The complete structure declaration might look like this struct lib_books { char title[20]; char author[15]; int pages; float price; }; struct lib_books book1,book2,book3;
  • 37. STRUCTURE WITHIN STRUCTURE #include<stdio.h> struct date{ int day; int month; Int year; }; struct student { int id; struct date birthday; char name[20]; } #include<stdio.h> struct date{ int day; int month; Int year; }; struct date{ int day; int month; int year; }birthday; char name[20]; }
  • 38. STRUCTURE OVER ARRAY • Array’s disadvantage is that all the elements stored in an array are to be of the same data type. • If we need to use a collection of different data type items it is not possible using an array. • We require using a collection of different data items of differnent data types we can use a structure.
  • 39. ARRAY WITHIN STRUCTURE • We often use array of structure Example: include<stdio.h> struct student{ int roll; int marks[5]; char name[10]; }; void main(){ struct student stu; int i, sum=0; printf(“Enter roll no:”); scanf (“/n%d”, & stu.roll); printf(“Enter name:/n”); scanf(“%s”, & stu.name); for(i=0; i<5; i++){ printf(“Enter marks %d”,i+1); scanf(“%d”, & stu.mark[i]); sum+=stu.mark[i]; } printf(“student details:/n”); printf(“name:%s”,stu.name); printf(“/nroll:%d”,stu.roll); printf(“/n total marks :%d”,sum); }
  • 40. ADVANTAGES AND DISADVANTAGES OF STRUCTURED PROGRAMMING • The advantages of adopting a structured approach to programming are numerous. • These include the following: • The sequence of operations is simple to trace, thus facilitating debugging. • There are a finite number of structures with standardized terminology. • Structures lend themselves easily to building subroutines. • The set of structures is complete; that is, a]1 programs can be written using three structures. • Structures are self-documenting and, therefore, easy to read. • Structures are easy to describe in flowcharts, syntax diagrams, pseudo code, and so on. • Structured programming results in increased programmer productivity-programs can be written faster.