SlideShare a Scribd company logo
1 of 39
Download to read offline
#include <stdio.h> //Print numbers in reversed order
#include <stdlib.h>
#include <time.h>
int main(){
srand(time(0));
int numbers[500];
int num_num;
printf("How many numbers (up to 500)?");
scanf(“%d”,&num_num);
for ( int i= 0; i < num_num; i++)
numbers[i] = rand()%100;
printf("n Your numbers reversed are:n");
for ( int j= num_num-1 ; j >= 0; j--)
printf(“%d”,numbers[j]);
printf(“n”);
return 0;}
Outline
Outline
 2000 Prentice Hall, Inc.
All rights reserved.
Examples Using Arrays
• Character arrays
– String “first” is really a static array of characters
– Character arrays can be initialized using string literals
char string1[] = "first";
• Null character '0' terminates strings
•string1 actually has 6 elements
– It is equivalent to
char string1[] = { 'f', 'i', 'r', 's', 't', '0' };
– Can access individual characters
string1[ 3 ] is character ‘s’
– Array name is address of array, so & not needed for scanf
scanf( "%s", string2 );
• Reads characters until whitespace encountered
• Can write beyond end of array, be careful
Outline
22
Outline
 2000 Prentice Hall, Inc.
All rights reserved.
1. Initialize strings
2. Print strings
2.1 Define loop
2.2 Print characters
individually
2.3 Input string
3. Print string
Program Output
1 /* Fig. 6.10: fig06_10.c
2 Treating character arrays as strings */
3 #include <stdio.h>
4
5 int main()
6 {
7 char string1[ 20 ], string2[] = "string literal";
8 int i;
9
10 printf(" Enter a string: ");
11 scanf( "%s", string1 );
12 printf( "string1 is: %snstring2: is %sn"
13 "string1 with spaces between characters is:n",
14 string1, string2 );
15
16 for ( i = 0; string1[ i ] != '0'; i++ )
17 printf( "%c ", string1[ i ] );
18
19 printf( "n" );
20 return 0;
21 }
Enter a string: Hello there
string1 is: Hello
string2 is: string literal
string1 with spaces between characters is:
H e l l o
Passing Arrays to Functions
• Passing arrays
– To pass an array argument to a function, specify the name of
the array without any brackets
int myArray[ 24 ];
myFunction( myArray, 24 );
• Array size usually passed to function
– Arrays passed call-by-reference
– Name of array is address of first element
– Function knows where the array is stored
• Modifies original memory locations
• Passing array elements
– Passed by call-by-value
– Pass subscripted name (i.e., myArray[ 3 ]) to function
Passing Arrays to Functions
• Function prototype
void modifyArray( int b[], int arraySize
);
– Parameter names optional in prototype
•int b[] could be written int []
•int arraySize could be simply int
Array arguments in function
#include <stdio.h>
void myFunction(int yourArray[], int n);
int main ()
{
int i;
int myArray[4] = {0};
myFunction( myArray, 4);
for (i = 0; i < 4; i++)
printf(“%dn”,myArray[i]);
return 0;
}
void myFunction (int yourArray[], int n)
{
int i;
for (i = 0; i < n; i++)
yourArray[i] = i;
}
0
1
2
3

More Related Content

Similar to Lecture14.pdf

Unit3 jwfiles
Unit3 jwfilesUnit3 jwfiles
Unit3 jwfilesmrecedu
 
9 character string &amp; string library
9  character string &amp; string library9  character string &amp; string library
9 character string &amp; string libraryMomenMostafa
 
Strings in C language
Strings in C languageStrings in C language
Strings in C languageP M Patil
 
SPL 13 | Character Array(String) in C
SPL 13 | Character Array(String) in CSPL 13 | Character Array(String) in C
SPL 13 | Character Array(String) in CMohammad Imam Hossain
 
0-Slot21-22-Strings.pdf
0-Slot21-22-Strings.pdf0-Slot21-22-Strings.pdf
0-Slot21-22-Strings.pdfssusere19c741
 
Handling of character strings C programming
Handling of character strings C programmingHandling of character strings C programming
Handling of character strings C programmingAppili Vamsi Krishna
 
L13 string handling(string class)
L13 string handling(string class)L13 string handling(string class)
L13 string handling(string class)teach4uin
 
Data structure week 3
Data structure week 3Data structure week 3
Data structure week 3karmuhtam
 
Array and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptxArray and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptxJumanneChiyanda
 
Character Array and String
Character Array and StringCharacter Array and String
Character Array and StringTasnima Hamid
 
5 2. string processing
5 2. string processing5 2. string processing
5 2. string processing웅식 전
 
INDIAN INSTITUTE OF TECHNOLOGY KANPURESC 111M Lec13.pptx
INDIAN INSTITUTE OF TECHNOLOGY KANPURESC 111M Lec13.pptxINDIAN INSTITUTE OF TECHNOLOGY KANPURESC 111M Lec13.pptx
INDIAN INSTITUTE OF TECHNOLOGY KANPURESC 111M Lec13.pptxAbhimanyuChaure
 

Similar to Lecture14.pdf (20)

Unit3 jwfiles
Unit3 jwfilesUnit3 jwfiles
Unit3 jwfiles
 
Arrays
ArraysArrays
Arrays
 
9 character string &amp; string library
9  character string &amp; string library9  character string &amp; string library
9 character string &amp; string library
 
Strings in C language
Strings in C languageStrings in C language
Strings in C language
 
Session 4
Session 4Session 4
Session 4
 
Array
ArrayArray
Array
 
SPL 13 | Character Array(String) in C
SPL 13 | Character Array(String) in CSPL 13 | Character Array(String) in C
SPL 13 | Character Array(String) in C
 
Array&amp;string
Array&amp;stringArray&amp;string
Array&amp;string
 
0-Slot21-22-Strings.pdf
0-Slot21-22-Strings.pdf0-Slot21-22-Strings.pdf
0-Slot21-22-Strings.pdf
 
Handling of character strings C programming
Handling of character strings C programmingHandling of character strings C programming
Handling of character strings C programming
 
L13 string handling(string class)
L13 string handling(string class)L13 string handling(string class)
L13 string handling(string class)
 
[ITP - Lecture 17] Strings in C/C++
[ITP - Lecture 17] Strings in C/C++[ITP - Lecture 17] Strings in C/C++
[ITP - Lecture 17] Strings in C/C++
 
Unit3 C
Unit3 C Unit3 C
Unit3 C
 
Data structure week 3
Data structure week 3Data structure week 3
Data structure week 3
 
Array and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptxArray and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptx
 
Character Array and String
Character Array and StringCharacter Array and String
Character Array and String
 
5 2. string processing
5 2. string processing5 2. string processing
5 2. string processing
 
PPS_Unit 4.ppt
PPS_Unit 4.pptPPS_Unit 4.ppt
PPS_Unit 4.ppt
 
Strings
StringsStrings
Strings
 
INDIAN INSTITUTE OF TECHNOLOGY KANPURESC 111M Lec13.pptx
INDIAN INSTITUTE OF TECHNOLOGY KANPURESC 111M Lec13.pptxINDIAN INSTITUTE OF TECHNOLOGY KANPURESC 111M Lec13.pptx
INDIAN INSTITUTE OF TECHNOLOGY KANPURESC 111M Lec13.pptx
 

More from JoyPalit

Chain_Rule.pdf
Chain_Rule.pdfChain_Rule.pdf
Chain_Rule.pdfJoyPalit
 
4204 Chapt 3 (L-1) Water pollution (Introduction).pdf
4204 Chapt 3 (L-1) Water pollution (Introduction).pdf4204 Chapt 3 (L-1) Water pollution (Introduction).pdf
4204 Chapt 3 (L-1) Water pollution (Introduction).pdfJoyPalit
 
ACCE 201 Lec 01.pdf
ACCE 201 Lec 01.pdfACCE 201 Lec 01.pdf
ACCE 201 Lec 01.pdfJoyPalit
 
Week3_Notes.pdf
Week3_Notes.pdfWeek3_Notes.pdf
Week3_Notes.pdfJoyPalit
 
Week2_Notes.pdf
Week2_Notes.pdfWeek2_Notes.pdf
Week2_Notes.pdfJoyPalit
 
Week1_Notes.pdf
Week1_Notes.pdfWeek1_Notes.pdf
Week1_Notes.pdfJoyPalit
 
Lecture15.pdf
Lecture15.pdfLecture15.pdf
Lecture15.pdfJoyPalit
 
Lecture16.pdf
Lecture16.pdfLecture16.pdf
Lecture16.pdfJoyPalit
 
Lecture17.pdf
Lecture17.pdfLecture17.pdf
Lecture17.pdfJoyPalit
 
Lecture1.pdf
Lecture1.pdfLecture1.pdf
Lecture1.pdfJoyPalit
 

More from JoyPalit (10)

Chain_Rule.pdf
Chain_Rule.pdfChain_Rule.pdf
Chain_Rule.pdf
 
4204 Chapt 3 (L-1) Water pollution (Introduction).pdf
4204 Chapt 3 (L-1) Water pollution (Introduction).pdf4204 Chapt 3 (L-1) Water pollution (Introduction).pdf
4204 Chapt 3 (L-1) Water pollution (Introduction).pdf
 
ACCE 201 Lec 01.pdf
ACCE 201 Lec 01.pdfACCE 201 Lec 01.pdf
ACCE 201 Lec 01.pdf
 
Week3_Notes.pdf
Week3_Notes.pdfWeek3_Notes.pdf
Week3_Notes.pdf
 
Week2_Notes.pdf
Week2_Notes.pdfWeek2_Notes.pdf
Week2_Notes.pdf
 
Week1_Notes.pdf
Week1_Notes.pdfWeek1_Notes.pdf
Week1_Notes.pdf
 
Lecture15.pdf
Lecture15.pdfLecture15.pdf
Lecture15.pdf
 
Lecture16.pdf
Lecture16.pdfLecture16.pdf
Lecture16.pdf
 
Lecture17.pdf
Lecture17.pdfLecture17.pdf
Lecture17.pdf
 
Lecture1.pdf
Lecture1.pdfLecture1.pdf
Lecture1.pdf
 

Recently uploaded

ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 

Recently uploaded (20)

ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 

Lecture14.pdf

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. #include <stdio.h> //Print numbers in reversed order #include <stdlib.h> #include <time.h> int main(){ srand(time(0)); int numbers[500]; int num_num; printf("How many numbers (up to 500)?"); scanf(“%d”,&num_num); for ( int i= 0; i < num_num; i++) numbers[i] = rand()%100; printf("n Your numbers reversed are:n"); for ( int j= num_num-1 ; j >= 0; j--) printf(“%d”,numbers[j]); printf(“n”); return 0;}
  • 20. Outline Outline  2000 Prentice Hall, Inc. All rights reserved.
  • 21. Examples Using Arrays • Character arrays – String “first” is really a static array of characters – Character arrays can be initialized using string literals char string1[] = "first"; • Null character '0' terminates strings •string1 actually has 6 elements – It is equivalent to char string1[] = { 'f', 'i', 'r', 's', 't', '0' }; – Can access individual characters string1[ 3 ] is character ‘s’ – Array name is address of array, so & not needed for scanf scanf( "%s", string2 ); • Reads characters until whitespace encountered • Can write beyond end of array, be careful
  • 22. Outline 22 Outline  2000 Prentice Hall, Inc. All rights reserved. 1. Initialize strings 2. Print strings 2.1 Define loop 2.2 Print characters individually 2.3 Input string 3. Print string Program Output 1 /* Fig. 6.10: fig06_10.c 2 Treating character arrays as strings */ 3 #include <stdio.h> 4 5 int main() 6 { 7 char string1[ 20 ], string2[] = "string literal"; 8 int i; 9 10 printf(" Enter a string: "); 11 scanf( "%s", string1 ); 12 printf( "string1 is: %snstring2: is %sn" 13 "string1 with spaces between characters is:n", 14 string1, string2 ); 15 16 for ( i = 0; string1[ i ] != '0'; i++ ) 17 printf( "%c ", string1[ i ] ); 18 19 printf( "n" ); 20 return 0; 21 } Enter a string: Hello there string1 is: Hello string2 is: string literal string1 with spaces between characters is: H e l l o
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32. Passing Arrays to Functions • Passing arrays – To pass an array argument to a function, specify the name of the array without any brackets int myArray[ 24 ]; myFunction( myArray, 24 ); • Array size usually passed to function – Arrays passed call-by-reference – Name of array is address of first element – Function knows where the array is stored • Modifies original memory locations • Passing array elements – Passed by call-by-value – Pass subscripted name (i.e., myArray[ 3 ]) to function
  • 33. Passing Arrays to Functions • Function prototype void modifyArray( int b[], int arraySize ); – Parameter names optional in prototype •int b[] could be written int [] •int arraySize could be simply int
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39. Array arguments in function #include <stdio.h> void myFunction(int yourArray[], int n); int main () { int i; int myArray[4] = {0}; myFunction( myArray, 4); for (i = 0; i < 4; i++) printf(“%dn”,myArray[i]); return 0; } void myFunction (int yourArray[], int n) { int i; for (i = 0; i < n; i++) yourArray[i] = i; } 0 1 2 3