IHYPRESS.NET > C PROGRAMMING
HOME | ASP | C | HTML/CSS | JAVASCRIPT | MATLAB | PERL | PHP | PYTHON | RUBY
C > 07. Arrays I (1D) [PROGRAM #01]
CODERESULT
 
/* Problem: This program initializes an array with all cells 
filled with the same value (0.0 in this example) */

#include <stdio.h>
#define SIZE 100 /* size of the array */
#define VALUE 0.0

int 
main (void)
{

	double x[SIZE];
	int i;

	/* initializing the array with the same value */
	for (i=0; i<SIZE; ++i)
		x[i] = VALUE;


	/* printing the array for verification */
	for (i=0; i<SIZE; ++i)
		printf ("%5.1lf", x[i]);

	return (0);
}
 

Legend: preprocessor directives | variable declarations main function | helper functions | user-defined structures comments
  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
>
COPYRIGHT © 2019 IHYPRESS.NET. A DIVISION OF IHY PRESS, KIRKLAND, WA 98083 USA. ALL RIGHTS RESERVED.
Deals of the Week: New deals every week, online only!
SHARE