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)

PPTX
Unit 3(Arrays).pptx arrays topics in the c lang
PPTX
ECE2102-Week13 - 14-Strhhhhhhhjjjucts.pptx
PPTX
Mca ii dfs u-2 array records and pointer
PPTX
POLITEKNIK MALAYSIA
PDF
java.pdf
PPTX
PPTX
Computer science ( Structures In C ) Ppt
PPTX
Chapter 2.datatypes and operators
PPT
pointers (1).ppt
PPT
PPTX
CHAPTER -4-class and structure.pptx
PPSX
Pointers
PPTX
COM1407: Working with Pointers
PDF
Chapter 5 (Part I) - Pointers.pdf
PDF
PPTX
Pointer.pptx
PPTX
Chp3(pointers ref)
PPTX
User defined data types.pptx
PPTX
Unit-4-1.pptxjtjrjfjfjfjfjfjfjfjrjrjrjrjejejeje
PPT
Unit 3(Arrays).pptx arrays topics in the c lang
ECE2102-Week13 - 14-Strhhhhhhhjjjucts.pptx
Mca ii dfs u-2 array records and pointer
POLITEKNIK MALAYSIA
java.pdf
Computer science ( Structures In C ) Ppt
Chapter 2.datatypes and operators
pointers (1).ppt
CHAPTER -4-class and structure.pptx
Pointers
COM1407: Working with Pointers
Chapter 5 (Part I) - Pointers.pdf
Pointer.pptx
Chp3(pointers ref)
User defined data types.pptx
Unit-4-1.pptxjtjrjfjfjfjfjfjfjfjrjrjrjrjejejeje
Ad

Recently uploaded (20)

PDF
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
PDF
CRP102_SAGALASSOS_Final_Projects_2025.pdf
PPTX
RIZALS-LIFE-HIGHER-EDUCATION-AND-LIFE-ABROAD.pptx
PDF
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
PDF
International_Financial_Reporting_Standa.pdf
PDF
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI Syllabus.pdf
PDF
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
PDF
IP : I ; Unit I : Preformulation Studies
PDF
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PDF
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
PPTX
Education and Perspectives of Education.pptx
PDF
Empowerment Technology for Senior High School Guide
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PPTX
MICROPARA INTRODUCTION XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PDF
Journal of Dental Science - UDMY (2021).pdf
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PDF
M.Tech in Aerospace Engineering | BIT Mesra
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
PDF
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
CRP102_SAGALASSOS_Final_Projects_2025.pdf
RIZALS-LIFE-HIGHER-EDUCATION-AND-LIFE-ABROAD.pptx
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
International_Financial_Reporting_Standa.pdf
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI Syllabus.pdf
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
IP : I ; Unit I : Preformulation Studies
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
Education and Perspectives of Education.pptx
Empowerment Technology for Senior High School Guide
Cambridge-Practice-Tests-for-IELTS-12.docx
MICROPARA INTRODUCTION XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Journal of Dental Science - UDMY (2021).pdf
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
M.Tech in Aerospace Engineering | BIT Mesra
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf

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.