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
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);
}
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

What's hot

Presentation on c programing satcture
Presentation on c programing satcture Presentation on c programing satcture
Presentation on c programing satcture
topu93
 
Array in C
Array in CArray in C
Array in C
adityas29
 
Array in-c
Array in-cArray in-c
Array in-c
Samsil Arefin
 
arrays of structures
arrays of structuresarrays of structures
arrays of structures
arushi bhatnagar
 
17 structure-and-union
17 structure-and-union17 structure-and-union
17 structure-and-union
Rohit Shrivastava
 
Array in c
Array in cArray in c
Array in c
AnIsh Kumar
 
Unit 9. Structure and Unions
Unit 9. Structure and UnionsUnit 9. Structure and Unions
Unit 9. Structure and Unions
Ashim Lamichhane
 
Array in c language
Array in c language Array in c language
Array in c language
umesh patil
 
Basic array in c programming
Basic array in c programmingBasic array in c programming
Basic array in c programming
Sajid Hasan
 
Array in c programming
Array in c programmingArray in c programming
Array in c programming
2569294Mohan
 
Array in (C) programing
Array in (C) programing Array in (C) programing
Array in (C) programing
mJafarww
 
Arrays Basics
Arrays BasicsArrays Basics
Arrays Basics
Nikhil Pandit
 
Introduction linked list
Introduction linked listIntroduction linked list
Introduction linked list
MohammedShameer28
 
Arrays in c language
Arrays in c languageArrays in c language
Arrays in c language
tanmaymodi4
 
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdfSTRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
SowmyaJyothi3
 
C96e1 session3 c++
C96e1 session3 c++C96e1 session3 c++
C96e1 session3 c++
Mukund Trivedi
 
C++ lecture 04
C++ lecture 04C++ lecture 04
C++ lecture 04
HNDE Labuduwa Galle
 
Array C programming
Array C programmingArray C programming
Array C programming
Prionto Abdullah
 

What's hot (18)

Presentation on c programing satcture
Presentation on c programing satcture Presentation on c programing satcture
Presentation on c programing satcture
 
Array in C
Array in CArray in C
Array in C
 
Array in-c
Array in-cArray in-c
Array in-c
 
arrays of structures
arrays of structuresarrays of structures
arrays of structures
 
17 structure-and-union
17 structure-and-union17 structure-and-union
17 structure-and-union
 
Array in c
Array in cArray in c
Array in c
 
Unit 9. Structure and Unions
Unit 9. Structure and UnionsUnit 9. Structure and Unions
Unit 9. Structure and Unions
 
Array in c language
Array in c language Array in c language
Array in c language
 
Basic array in c programming
Basic array in c programmingBasic array in c programming
Basic array in c programming
 
Array in c programming
Array in c programmingArray in c programming
Array in c programming
 
Array in (C) programing
Array in (C) programing Array in (C) programing
Array in (C) programing
 
Arrays Basics
Arrays BasicsArrays Basics
Arrays Basics
 
Introduction linked list
Introduction linked listIntroduction linked list
Introduction linked list
 
Arrays in c language
Arrays in c languageArrays in c language
Arrays in c language
 
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdfSTRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
 
C96e1 session3 c++
C96e1 session3 c++C96e1 session3 c++
C96e1 session3 c++
 
C++ lecture 04
C++ lecture 04C++ lecture 04
C++ lecture 04
 
Array C programming
Array C programmingArray C programming
Array C programming
 

Similar to Welcome to our_presentation in c

Mca ii dfs u-2 array records and pointer
Mca ii dfs u-2 array records and pointerMca ii dfs u-2 array records and pointer
Mca ii dfs u-2 array records and pointer
Rai University
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
Aiman Hud
 
java.pdf
java.pdfjava.pdf
java.pdf
RAJCHATTERJEE24
 
C
CC
Chapter 2.datatypes and operators
Chapter 2.datatypes and operatorsChapter 2.datatypes and operators
Chapter 2.datatypes and operators
Jasleen Kaur (Chandigarh University)
 
pointers (1).ppt
pointers (1).pptpointers (1).ppt
pointers (1).ppt
Osmania University
 
Session 5
Session 5Session 5
CHAPTER -4-class and structure.pptx
CHAPTER -4-class and structure.pptxCHAPTER -4-class and structure.pptx
CHAPTER -4-class and structure.pptx
GebruGetachew2
 
Pointers
PointersPointers
Pointers
Frijo Francis
 
COM1407: Working with Pointers
COM1407: Working with PointersCOM1407: Working with Pointers
COM1407: Working with Pointers
Hemantha Kulathilake
 
Chapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdfChapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdf
TamiratDejene1
 
aspice
aspiceaspice
Pointer.pptx
Pointer.pptxPointer.pptx
Pointer.pptx
SwapnaliPawar27
 
Chp3(pointers ref)
Chp3(pointers ref)Chp3(pointers ref)
Chp3(pointers ref)
Mohd Effandi
 
User defined data types.pptx
User defined data types.pptxUser defined data types.pptx
User defined data types.pptx
Ananthi Palanisamy
 
8 Pointers
8 Pointers8 Pointers
Structured Languages
Structured LanguagesStructured Languages
Structured Languages
Mufaddal Nullwala
 
Data Handling
Data HandlingData Handling
Data Handling
Praveen M Jigajinni
 
FYBSC(CS)_UNIT-1_Pointers in C.pptx
FYBSC(CS)_UNIT-1_Pointers in C.pptxFYBSC(CS)_UNIT-1_Pointers in C.pptx
FYBSC(CS)_UNIT-1_Pointers in C.pptx
sangeeta borde
 
Mca 1 pic u-5 pointer, structure ,union and intro to file handling
Mca 1 pic u-5 pointer, structure ,union and intro to file handlingMca 1 pic u-5 pointer, structure ,union and intro to file handling
Mca 1 pic u-5 pointer, structure ,union and intro to file handling
Rai University
 

Similar to Welcome to our_presentation in c (20)

Mca ii dfs u-2 array records and pointer
Mca ii dfs u-2 array records and pointerMca ii dfs u-2 array records and pointer
Mca ii dfs u-2 array records and pointer
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
java.pdf
java.pdfjava.pdf
java.pdf
 
C
CC
C
 
Chapter 2.datatypes and operators
Chapter 2.datatypes and operatorsChapter 2.datatypes and operators
Chapter 2.datatypes and operators
 
pointers (1).ppt
pointers (1).pptpointers (1).ppt
pointers (1).ppt
 
Session 5
Session 5Session 5
Session 5
 
CHAPTER -4-class and structure.pptx
CHAPTER -4-class and structure.pptxCHAPTER -4-class and structure.pptx
CHAPTER -4-class and structure.pptx
 
Pointers
PointersPointers
Pointers
 
COM1407: Working with Pointers
COM1407: Working with PointersCOM1407: Working with Pointers
COM1407: Working with Pointers
 
Chapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdfChapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdf
 
aspice
aspiceaspice
aspice
 
Pointer.pptx
Pointer.pptxPointer.pptx
Pointer.pptx
 
Chp3(pointers ref)
Chp3(pointers ref)Chp3(pointers ref)
Chp3(pointers ref)
 
User defined data types.pptx
User defined data types.pptxUser defined data types.pptx
User defined data types.pptx
 
8 Pointers
8 Pointers8 Pointers
8 Pointers
 
Structured Languages
Structured LanguagesStructured Languages
Structured Languages
 
Data Handling
Data HandlingData Handling
Data Handling
 
FYBSC(CS)_UNIT-1_Pointers in C.pptx
FYBSC(CS)_UNIT-1_Pointers in C.pptxFYBSC(CS)_UNIT-1_Pointers in C.pptx
FYBSC(CS)_UNIT-1_Pointers in C.pptx
 
Mca 1 pic u-5 pointer, structure ,union and intro to file handling
Mca 1 pic u-5 pointer, structure ,union and intro to file handlingMca 1 pic u-5 pointer, structure ,union and intro to file handling
Mca 1 pic u-5 pointer, structure ,union and intro to file handling
 

Recently uploaded

UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 

Recently uploaded (20)

UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 

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]); } } }
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 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); }
  • 30.
  • 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.