SlideShare a Scribd company logo
1 of 9
C PROGRAMMING
BY MOHAMMED TAJUDDIN
C PROGRAMMING
Array ascending order :
#include<stdio.h>
int main(){
int a[5]={9,6,3,1,4},i,j,temp;
printf(“array ascending order isn”);
for(i=0;i<5;i++){
for(j=i+1;j<5;j++){
if(a[i]>a[j];{
temp=a[i];
a[i]=a[j];
a[j]=temp;}}}
C PROGRAMMING
for(i=0;i<5;i++)
{
printf(“%dn”,a[i]);
}
return 0;
}
}
C PROGRAMMING
#include<stdio.h>
int main(){
int a[5]={2,8,1,9,4};
int i,max;
printf(“maximum value in array is”);
max=a[0];
for(i=1;i<5;i++)
if(a[i]>max
max=a[i];
printf(“%dn”,max);
return 0;}
C PROGRAMMING
Two Dimentional Array :
#include<stdio.h>
int main(){
int a[4][3]={1,2,3,4,5,6,7,8,9,10,11,12};
int r,c;
printf(“two dimentional array isn”);
for(r=0;r<4;r++){
for(c=0;c<3;c++){
printf(“%d”,a[r][c]);}
printf(“n”);}
return 0;
}
C PROGRAMMING
Pointers :
The pointer in C language is a variable which stores the address of
another variable. This variable can be of type int, char, array, function,
or any other pointer. The size of the pointer depends on the
architecture. However, in 32-bit architecture the size of a pointer is 2
byte.
C PROGRAMMING
#include <stdio.h>
int main(){
int* p, c;
c = 22;
printf("Address of c: %pn", &c);
printf("Value of c: %dnn", c); // 22
pc = &c;
printf("Address of pointer pc: %pn", pc);
printf("Content of pointer pc: %dnn", *pc); // 22
c = 11;
printf("Address of pointer pc: %pn", pc);
printf("Content of pointer pc: %dnn", *pc); // 11
*pc = 2;
printf("Address of c: %pn", &c);
printf("Value of c: %dnn", c); // 2
return 0;
}
C PROGRAMMING
Function Pointer :
#include<stdio.h>
int sum(int,int);
intmain(){
int s=0;
int (*ptr)(int,int)=&sum;
s=(*ptr)(10,20);
printf(“%dn”,s);}
int sum(int a,int b){
return (a+b)}
C PROGRAMMING
Array of Poiters :
#include<stdio.h>
int main(){
int* p[5];
int i;
for(i=0;i<5;i++)
{
p[i]=&a[i];
printf(“%pn”,p[i]);
}

More Related Content

Similar to ARRAYS1.pptx (20)

DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
 
UNIT 2 LOOP CONTROL.pptx
UNIT 2 LOOP CONTROL.pptxUNIT 2 LOOP CONTROL.pptx
UNIT 2 LOOP CONTROL.pptx
 
C Prog - Array
C Prog - ArrayC Prog - Array
C Prog - Array
 
C Prog - Array
C Prog - ArrayC Prog - Array
C Prog - Array
 
Operating system labs
Operating system labsOperating system labs
Operating system labs
 
Let us C (by yashvant Kanetkar) chapter 3 Solution
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 Solution
 
Data structure new lab manual
Data structure  new lab manualData structure  new lab manual
Data structure new lab manual
 
Pnno
PnnoPnno
Pnno
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
DSC program.pdf
DSC program.pdfDSC program.pdf
DSC program.pdf
 
Ada file
Ada fileAda file
Ada file
 
week-21x
week-21xweek-21x
week-21x
 
Vcs16
Vcs16Vcs16
Vcs16
 
Programming Fundamentals Arrays and Strings
Programming Fundamentals   Arrays and Strings Programming Fundamentals   Arrays and Strings
Programming Fundamentals Arrays and Strings
 
C programs
C programsC programs
C programs
 
Basic C Programming Lab Practice
Basic C Programming Lab PracticeBasic C Programming Lab Practice
Basic C Programming Lab Practice
 
LET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSLET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERS
 
Insertion_Sort_Code.pdf
Insertion_Sort_Code.pdfInsertion_Sort_Code.pdf
Insertion_Sort_Code.pdf
 
Os lab file c programs
Os lab file c programsOs lab file c programs
Os lab file c programs
 

More from MohammedtajuddinTaju (11)

EMBEDDED SYSTEM AUTOSAR.pdf
EMBEDDED SYSTEM AUTOSAR.pdfEMBEDDED SYSTEM AUTOSAR.pdf
EMBEDDED SYSTEM AUTOSAR.pdf
 
numbers_systems.pptx
numbers_systems.pptxnumbers_systems.pptx
numbers_systems.pptx
 
POINTERS.pptx
POINTERS.pptxPOINTERS.pptx
POINTERS.pptx
 
LOOPS IN C.pptx
LOOPS IN C.pptxLOOPS IN C.pptx
LOOPS IN C.pptx
 
FUNCTIONS1.pptx
FUNCTIONS1.pptxFUNCTIONS1.pptx
FUNCTIONS1.pptx
 
FUNCTIONS.pptx
FUNCTIONS.pptxFUNCTIONS.pptx
FUNCTIONS.pptx
 
ARRAYS.pptx
ARRAYS.pptxARRAYS.pptx
ARRAYS.pptx
 
DMA.pptx
DMA.pptxDMA.pptx
DMA.pptx
 
INTRODUCTION TO C LANGUAGE.pptx
INTRODUCTION TO C LANGUAGE.pptxINTRODUCTION TO C LANGUAGE.pptx
INTRODUCTION TO C LANGUAGE.pptx
 
EMBEDDED SYSTEMS INTRODUCTION.pptx
EMBEDDED SYSTEMS INTRODUCTION.pptxEMBEDDED SYSTEMS INTRODUCTION.pptx
EMBEDDED SYSTEMS INTRODUCTION.pptx
 
C PROGRAMING.pptx
C PROGRAMING.pptxC PROGRAMING.pptx
C PROGRAMING.pptx
 

Recently uploaded

£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))
£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))
£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))Obat Cytotec
 
Buy best abortion pills Doha [+966572737505 | Planned cytotec Qatar
Buy best abortion pills Doha [+966572737505 | Planned cytotec QatarBuy best abortion pills Doha [+966572737505 | Planned cytotec Qatar
Buy best abortion pills Doha [+966572737505 | Planned cytotec Qatarsamsungultra782445
 
NO1 Pakistan Best vashikaran specialist in UK USA UAE London Dubai Canada Ame...
NO1 Pakistan Best vashikaran specialist in UK USA UAE London Dubai Canada Ame...NO1 Pakistan Best vashikaran specialist in UK USA UAE London Dubai Canada Ame...
NO1 Pakistan Best vashikaran specialist in UK USA UAE London Dubai Canada Ame...Amil Baba Dawood bangali
 
办理(uw学位证书)美国华盛顿大学毕业证续费收据一模一样
办理(uw学位证书)美国华盛顿大学毕业证续费收据一模一样办理(uw学位证书)美国华盛顿大学毕业证续费收据一模一样
办理(uw学位证书)美国华盛顿大学毕业证续费收据一模一样vwymvu
 
Cyber-Security-power point presentation.
Cyber-Security-power point presentation.Cyber-Security-power point presentation.
Cyber-Security-power point presentation.ECoyShastriBhawan
 
如何办理(OP毕业证书)奥塔哥理工学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(OP毕业证书)奥塔哥理工学院毕业证成绩单本科硕士学位证留信学历认证如何办理(OP毕业证书)奥塔哥理工学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(OP毕业证书)奥塔哥理工学院毕业证成绩单本科硕士学位证留信学历认证mestb
 
如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证mestb
 
NO1 Best Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Addre...
NO1 Best Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Addre...NO1 Best Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Addre...
NO1 Best Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Addre...Amil baba
 
Matrix Methods.pptxhhhhhhhhhhhhhhhhhhhhh
Matrix Methods.pptxhhhhhhhhhhhhhhhhhhhhhMatrix Methods.pptxhhhhhhhhhhhhhhhhhhhhh
Matrix Methods.pptxhhhhhhhhhhhhhhhhhhhhhjoshuaclack73
 
一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样
一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样
一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样ayoqf
 
如何办理(AUT毕业证书)奥克兰理工大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(AUT毕业证书)奥克兰理工大学毕业证成绩单本科硕士学位证留信学历认证如何办理(AUT毕业证书)奥克兰理工大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(AUT毕业证书)奥克兰理工大学毕业证成绩单本科硕士学位证留信学历认证mestb
 
Vibration of Continuous Systems.pjjjjjjjjptx
Vibration of Continuous Systems.pjjjjjjjjptxVibration of Continuous Systems.pjjjjjjjjptx
Vibration of Continuous Systems.pjjjjjjjjptxjoshuaclack73
 
如何办理(UVic毕业证书)维多利亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UVic毕业证书)维多利亚大学毕业证成绩单本科硕士学位证留信学历认证如何办理(UVic毕业证书)维多利亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UVic毕业证书)维多利亚大学毕业证成绩单本科硕士学位证留信学历认证mestb
 
如何办理(USYD毕业证书)悉尼大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(USYD毕业证书)悉尼大学毕业证成绩单本科硕士学位证留信学历认证如何办理(USYD毕业证书)悉尼大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(USYD毕业证书)悉尼大学毕业证成绩单本科硕士学位证留信学历认证mestb
 

Recently uploaded (17)

£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))
£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))
£ HAMIL 5 BULAN £ CARA MENGGUGURKAN KANDUNGAN USIA 5 BULAN ((087776558899))
 
Buy best abortion pills Doha [+966572737505 | Planned cytotec Qatar
Buy best abortion pills Doha [+966572737505 | Planned cytotec QatarBuy best abortion pills Doha [+966572737505 | Planned cytotec Qatar
Buy best abortion pills Doha [+966572737505 | Planned cytotec Qatar
 
Abortion pills in Jeddah Saudi Arabia! +966572737505 Where to buy cytotec
Abortion pills in Jeddah Saudi Arabia! +966572737505 Where to buy cytotecAbortion pills in Jeddah Saudi Arabia! +966572737505 Where to buy cytotec
Abortion pills in Jeddah Saudi Arabia! +966572737505 Where to buy cytotec
 
NO1 Pakistan Best vashikaran specialist in UK USA UAE London Dubai Canada Ame...
NO1 Pakistan Best vashikaran specialist in UK USA UAE London Dubai Canada Ame...NO1 Pakistan Best vashikaran specialist in UK USA UAE London Dubai Canada Ame...
NO1 Pakistan Best vashikaran specialist in UK USA UAE London Dubai Canada Ame...
 
Abortion Pills in Jeddah |+966572737505 | Get Cytotec
Abortion Pills in Jeddah |+966572737505 | Get CytotecAbortion Pills in Jeddah |+966572737505 | Get Cytotec
Abortion Pills in Jeddah |+966572737505 | Get Cytotec
 
办理(uw学位证书)美国华盛顿大学毕业证续费收据一模一样
办理(uw学位证书)美国华盛顿大学毕业证续费收据一模一样办理(uw学位证书)美国华盛顿大学毕业证续费收据一模一样
办理(uw学位证书)美国华盛顿大学毕业证续费收据一模一样
 
Cyber-Security-power point presentation.
Cyber-Security-power point presentation.Cyber-Security-power point presentation.
Cyber-Security-power point presentation.
 
如何办理(OP毕业证书)奥塔哥理工学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(OP毕业证书)奥塔哥理工学院毕业证成绩单本科硕士学位证留信学历认证如何办理(OP毕业证书)奥塔哥理工学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(OP毕业证书)奥塔哥理工学院毕业证成绩单本科硕士学位证留信学历认证
 
如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(SUT毕业证书)斯威本科技大学毕业证成绩单本科硕士学位证留信学历认证
 
NO1 Best Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Addre...
NO1 Best Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Addre...NO1 Best Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Addre...
NO1 Best Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Addre...
 
Matrix Methods.pptxhhhhhhhhhhhhhhhhhhhhh
Matrix Methods.pptxhhhhhhhhhhhhhhhhhhhhhMatrix Methods.pptxhhhhhhhhhhhhhhhhhhhhh
Matrix Methods.pptxhhhhhhhhhhhhhhhhhhhhh
 
一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样
一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样
一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样
 
如何办理(AUT毕业证书)奥克兰理工大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(AUT毕业证书)奥克兰理工大学毕业证成绩单本科硕士学位证留信学历认证如何办理(AUT毕业证书)奥克兰理工大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(AUT毕业证书)奥克兰理工大学毕业证成绩单本科硕士学位证留信学历认证
 
Vibration of Continuous Systems.pjjjjjjjjptx
Vibration of Continuous Systems.pjjjjjjjjptxVibration of Continuous Systems.pjjjjjjjjptx
Vibration of Continuous Systems.pjjjjjjjjptx
 
Abortion pills in Riyadh Saudi Arabia!+966572737505 ) Where to get cytotec
Abortion pills in Riyadh Saudi Arabia!+966572737505 ) Where to get cytotecAbortion pills in Riyadh Saudi Arabia!+966572737505 ) Where to get cytotec
Abortion pills in Riyadh Saudi Arabia!+966572737505 ) Where to get cytotec
 
如何办理(UVic毕业证书)维多利亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UVic毕业证书)维多利亚大学毕业证成绩单本科硕士学位证留信学历认证如何办理(UVic毕业证书)维多利亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UVic毕业证书)维多利亚大学毕业证成绩单本科硕士学位证留信学历认证
 
如何办理(USYD毕业证书)悉尼大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(USYD毕业证书)悉尼大学毕业证成绩单本科硕士学位证留信学历认证如何办理(USYD毕业证书)悉尼大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(USYD毕业证书)悉尼大学毕业证成绩单本科硕士学位证留信学历认证
 

ARRAYS1.pptx

  • 2. C PROGRAMMING Array ascending order : #include<stdio.h> int main(){ int a[5]={9,6,3,1,4},i,j,temp; printf(“array ascending order isn”); for(i=0;i<5;i++){ for(j=i+1;j<5;j++){ if(a[i]>a[j];{ temp=a[i]; a[i]=a[j]; a[j]=temp;}}}
  • 4. C PROGRAMMING #include<stdio.h> int main(){ int a[5]={2,8,1,9,4}; int i,max; printf(“maximum value in array is”); max=a[0]; for(i=1;i<5;i++) if(a[i]>max max=a[i]; printf(“%dn”,max); return 0;}
  • 5. C PROGRAMMING Two Dimentional Array : #include<stdio.h> int main(){ int a[4][3]={1,2,3,4,5,6,7,8,9,10,11,12}; int r,c; printf(“two dimentional array isn”); for(r=0;r<4;r++){ for(c=0;c<3;c++){ printf(“%d”,a[r][c]);} printf(“n”);} return 0; }
  • 6. C PROGRAMMING Pointers : The pointer in C language is a variable which stores the address of another variable. This variable can be of type int, char, array, function, or any other pointer. The size of the pointer depends on the architecture. However, in 32-bit architecture the size of a pointer is 2 byte.
  • 7. C PROGRAMMING #include <stdio.h> int main(){ int* p, c; c = 22; printf("Address of c: %pn", &c); printf("Value of c: %dnn", c); // 22 pc = &c; printf("Address of pointer pc: %pn", pc); printf("Content of pointer pc: %dnn", *pc); // 22 c = 11; printf("Address of pointer pc: %pn", pc); printf("Content of pointer pc: %dnn", *pc); // 11 *pc = 2; printf("Address of c: %pn", &c); printf("Value of c: %dnn", c); // 2 return 0; }
  • 8. C PROGRAMMING Function Pointer : #include<stdio.h> int sum(int,int); intmain(){ int s=0; int (*ptr)(int,int)=&sum; s=(*ptr)(10,20); printf(“%dn”,s);} int sum(int a,int b){ return (a+b)}
  • 9. C PROGRAMMING Array of Poiters : #include<stdio.h> int main(){ int* p[5]; int i; for(i=0;i<5;i++) { p[i]=&a[i]; printf(“%pn”,p[i]); }