{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Lec c11 - Passing Arrays To Functions(Pass by reference...

This preview shows pages 1–4. Sign up to view the full content.

1 Computer Programming I TA C162 . Passing Arrays To Functions (Pass by reference) One- dimensional Array: int Maximum(int a[], int size); main() { int val[5]={3,5,2,7,4}; printf(“%d\n”,Maximum(val,5)); } int Maximum(int a[], int size) { int i, max = a[0]; for(i=0; i<size; i++) if(max<a[i]) max = a[i]; return(max); }

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Computer Programming I TA C162 . Character Manipulation in the String int main() { char s[80],ws[80]; int i,j; printf(“Enter the text:\n”); gets(s); /* reading text from user */ printf(“The text without blank space is:\n”); puts(ws); /* printing text on monitor */ return; } Q. Write a separate function for the same. for(i=0,j=0; s[i]!=‘\0‘; i++) { if(s[i]!=‘ ‘) ws[j++] = s[i]; } ws[j]=‘\0’;
3 Computer Programming I TA C162 . Important Character functions in ctype.h isdigit(c) /*Returns a nonzero if c is a digit*/ islower(c) /* Returns a nonzero if c is a lower case alphabetic character */ isalpha(c) /*Returns a nonzero if c is an alphabet*/ isspace(c) /*Returns a nonzero for blanks */ isupper(c) /*Returns a nonzero if c is capital letter*/ toupper(c) /* Returns upper case of c */ tolower(c) /* Returns lower case of c */

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 12

Lec c11 - Passing Arrays To Functions(Pass by reference...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online