A function that takes in an integer number and "returns" both twice the number and three times the number.
Philip R. Brown
/* Problem: Write a function that takes in an integer number and "returns" both twice the number and three times the number. */ #include <stdio.h> /* double_triple function begins */ int double_triple (int x, int *d) { int t; *d=2*x; /* double "returned" via pointer */ t=3*x; return (t); /* triple returned the standard way */ } /* double_triple function ends */ /* main program begins */ int main(void) { int a,twice,thrice; a=10; thrice = double_triple (a, &twice); printf("%d is two times %d.\n",twice,a); printf("%d is three times %d.\n",thrice,a); return(0); } /* main program ends */ |
20 is two times 10. 30 is three times 10. |
Hawaii Lawyer - Honolulu Attorney
Proudly Serving Honolulu, Maui, Kauai and the Big Island
Mr. Brown is AV Rated. The AV Peer Review Rating "shows that a lawyer has reached the height of professional excellence. He or she has usually practiced law for many years, and is recognized for the highest levels of skill and integrity."
No comments:
Post a Comment