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
COne Dimensional Arrays ❯ Using Functions with Arrays
<07.02>
/* Problem: This program asks the user for a value and fills all 100 cells of an array with that value */ #include <stdio.h> #define SIZE 100 /* size of the array */ /* no size in array parameter */ /* just a pointer to array in main */ void fill_array (int list[], int n, int in_value) { int i; for (i=0; i<n; ++i) list[i] = in_value; } int main (void) { int x[SIZE], i, value; /* initializing the array with a user value */ /* the 2nd argument must be the size of the array */ printf ("Enter a value: "); scanf ("%d", &value); fill_array (x, SIZE, value); /* printing the array for verification */ for (i=0; i<SIZE; ++i) printf ("%d ", x[i]); return (0); }
Hergestellt in Deutschland / Made in Germany
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland
Earn Free Bitcoin