IHYPRESS PROGRAMMING
Tutorials and C programs with code and output for beginners
c programming
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
CAdvanced Functions : Two Results
<06.05>
/* 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 */
Hergestellt in Deutschland / Made in Germany
20 is two times 10. 30 is three times 10.
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland