# include # include # include # include "vector.h" int main ( ); void timestamp ( ); /******************************************************************************/ int main ( ) /******************************************************************************/ /* Purpose: vector_test() tests vector(). Licensing: This code is distributed under the MIT license. Modified: 11 October 2025 Author: John Burkardt */ { int x_in[3] = { 10, 20, 30 }; int x_out[3]; timestamp ( ); printf ( "\n" ); printf ( "vector_test():\n" ); printf ( " C version\n" ); printf ( " Test vector(), with the interface:\n" ); printf ( " vector ( x_in, x_out )\n" ); printf ( "\n" ); printf ( " vector ( NULL, NULL )\n" ); vector ( NULL, NULL ); printf ( "\n" ); printf ( " vector ( NULL, x_out )\n" ); vector ( NULL, x_out ); printf ( "\n" ); printf ( " vector ( x_in, NULL )\n" ); vector ( x_in, NULL ); x_in[0] = 100; x_in[1] = 200; x_in[2] = 300; printf ( "\n" ); printf ( " vector ( x_in, x_out )\n" ); vector ( x_in, x_out ); /* Terminate. */ printf ( "\n" ); printf ( "vector_test():\n" ); printf ( " Normal end of execution.\n" ); printf ( "\n" ); timestamp ( ); return 0; } /******************************************************************************/ void timestamp ( ) /******************************************************************************/ /* Purpose: timestamp() prints the current YMDHMS date as a time stamp. Example: 17 June 2014 09:45:54 AM Licensing: This code is distributed under the MIT license. Modified: 01 May 2021 Author: John Burkardt */ { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct tm *tm; time_t now; now = time ( NULL ); tm = localtime ( &now ); strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm ); printf ( "%s\n", time_buffer ); return; # undef TIME_SIZE }