{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Lec34 - Computer Programming I TA C162 To be discussed...

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

1 Computer Programming I TA C162 . 12 Apr 2007 To be discussed today….. User-Defined Functions Examples Functions with no arguments and no return value Functions with arguments and no return value Functions with arguments and return value Functions with no arguments but returns a value Passing Array as an argument to a function One dimensional  Two dimensional Strings

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

View Full Document
2 Computer Programming I TA C162 . 12 Apr 2007 Functions with no arguments and no return value void displayline(void); void sum(void); void main() { displayline(); sum(); } void displayline() { int j; for(j=0;j<40;j++) printf(“*”); } void sum() {int a,b; printf(“Enter a and b\n”); scanf(“%d %d”,&a,&b); printf(“Sum = %d ”,(a+b)); } Calling function Called functions
3 Computer Programming I TA C162 . 12 Apr 2007 Functions with arguments and no return value void displayline(char); void Sum(float, float); void main() { char ch; float a,b; printf(“Enter character to print in line\n”); scanf(“%c”,&ch); displayline(ch); printf(“Enter value of a and b\n”); scanf(“%f %f”,&a,&b); Sum(a,b); }

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

View Full Document
4 Computer Programming I TA C162 . 12 Apr 2007 Functions Definition void displayline(char ch) { int j; for(j=0;j<40;j++) printf(“%c”,ch); } void Sum(float x, float y) { printf(“Sum = %f ”,(x+y)); }
5 Computer Programming I TA C162 .

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 ]}