SDDSlib
Loading...
Searching...
No Matches
fill_array.c File Reference

Provides functions to fill arrays of various data types with a specified value. More...

#include "mdb.h"

Go to the source code of this file.

Functions

void fill_double_array (double *array, long n, double value)
 Fills a double array with the specified value.
 
void fill_float_array (float *array, long n, float value)
 Fills a float array with the specified value.
 
void fill_long_array (long *array, long n, long value)
 Fills a long array with the specified value.
 
void fill_int_array (int *array, long n, int value)
 Fills an int array with the specified value.
 
void fill_short_array (short *array, long n, short value)
 Fills a short array with the specified value.
 

Detailed Description

Provides functions to fill arrays of various data types with a specified value.

License
This file is distributed under the terms of the Software License Agreement found in the file LICENSE included with this distribution.
Author
C. Saunders, M. Borland, R. Soliday

Definition in file fill_array.c.

Function Documentation

◆ fill_double_array()

void fill_double_array ( double * array,
long n,
double value )

Fills a double array with the specified value.

Assigns the given value to each element of the provided double array.

Parameters
arrayPointer to the double array to be filled.
nNumber of elements in the array.
valueThe double value to assign to each array element.

Definition at line 27 of file fill_array.c.

27 {
28 while (--n >= 0)
29 array[n] = value;
30}

◆ fill_float_array()

void fill_float_array ( float * array,
long n,
float value )

Fills a float array with the specified value.

Assigns the given value to each element of the provided float array.

Parameters
arrayPointer to the float array to be filled.
nNumber of elements in the array.
valueThe float value to assign to each array element.

Definition at line 41 of file fill_array.c.

41 {
42 while (--n >= 0)
43 array[n] = value;
44}

◆ fill_int_array()

void fill_int_array ( int * array,
long n,
int value )

Fills an int array with the specified value.

Assigns the given value to each element of the provided int array.

Parameters
arrayPointer to the int array to be filled.
nNumber of elements in the array.
valueThe int value to assign to each array element.

Definition at line 69 of file fill_array.c.

69 {
70 while (--n >= 0)
71 array[n] = value;
72}

◆ fill_long_array()

void fill_long_array ( long * array,
long n,
long value )

Fills a long array with the specified value.

Assigns the given value to each element of the provided long array.

Parameters
arrayPointer to the long array to be filled.
nNumber of elements in the array.
valueThe long value to assign to each array element.

Definition at line 55 of file fill_array.c.

55 {
56 while (--n >= 0)
57 array[n] = value;
58}

◆ fill_short_array()

void fill_short_array ( short * array,
long n,
short value )

Fills a short array with the specified value.

Assigns the given value to each element of the provided short array.

Parameters
arrayPointer to the short array to be filled.
nNumber of elements in the array.
valueThe short value to assign to each array element.

Definition at line 83 of file fill_array.c.

83 {
84 while (--n >= 0)
85 array[n] = value;
86}