This is an old revision of the document!
This page provides some programming puzzles to test your skill in C-programming. If the individual puzzles do not provide all information you require (e.g. use float or double for floating-point numbers), please fill in the gaps on your own and make reasonable assumptions.
Write a C program that uses a function to populate a dynamic one-dimensional array with random floating-point numbers. Allocate the array in the main method, and forward it to the function. Print the content of the array to the terminal in the main method after the function call. Implement the main method and the function in different source files. Use a dedicated header file to provide the function declaration. Provide a Makefile to build and to clean the program. Implement reasonable default values so that no additional user interaction is required to successfully execute the program. Document your code.
Expected Submission files: 2 source files, 1 header filer, 1 Makefile
Implement a structure which can hold a simple particle. The structure shall store two spatial integer coordinates (describing where the particle is located in a two-dimensional space) as well a floating-point quantity value for a particle. Implement a program which generates a dynamically sized set of particles and initializes it reasonably: the particles shall be evenly distributed in a 10×10 domain, i.e., 0≤x<10 and 0≤y<10, and assign random floating-point numbers (in the interval [0,1]) to each particle's quantity value. Write the set of initialized particles to a CSV output file - for each particle write the line in this format: x-position y-position quantity-value. The output file ending shall be '*.csv'. Also, provide a Makefile to build and clean the program. Document your code.
Expected Submission files: 1 source file, 1 Makefile