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 : Arrays and Pointers
<07.05>
/* Problem: This programs fills an array with a value submitted by the user. */ #include <stdio.h> #define SIZE 100 /* size of the array */ /* array parameter can be expressed as a pointer */ /* *list is the same thing as list[] */ 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]; int i, n; /* user enters a number */ printf ("Enter an integer number: "); scanf ("%d", &n); /* &x[0] is the address of the x[0] */ /* which is the same thing as x */ fill_array (&x[0], SIZE, n); /* printing the array for verification */ for (i=0; i<SIZE; ++i) printf ("%d ", x[i]); return (0); }
Hergestellt in Deutschland / Made in Germany
Enter an integer number: -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47 -47
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland