Algorithms_in_C 1.0.0
Set of algorithms implemented in C.
Loading...
Searching...
No Matches
test_min_printf.c File Reference

File used to test min_printf function. More...

#include "min_printf.h"
#include <stdio.h>
Include dependency graph for test_min_printf.c:

Functions

int main ()
 for min_printf function for printf function
 

Detailed Description

File used to test min_printf function.

The test will be executed by comparing the result of both min_printf and printf functions

Author
Jaskarn7
See also
min_printf.h

Function Documentation

◆ main()

int main ( void  )

for min_printf function for printf function

Main function

This function is used to test min_printf function. The numbers and string used for the test is generated randomly (The user can also specify their own value for tests) First integers were tested then floats and at last strings After running the program the user will see three pair of lines with each pair followed by an empty line In each pair of lines, the first line will be printed by min_printf function and next line by the actual printf function In each line user will see number or string covered with two colons, they are used to check from where the printing was started and where it ends

Returns
0 on exit

Printing an empty new line

25{
26 // print strings using `printf` and `min_printf`
27 min_printf(":%d: :%1.6d:\n", 12, 56);
28 printf(":%d: :%1.6d:\n", 12, 56);
29
30 printf("\n"); /// Printing an empty new line
31
32 // print floats or doubles using `printf` and `min_printf`
33 min_printf(":%f: :%3.6f:\n", 104.5654, 43.766443332);
34 printf(":%f: :%3.6f:\n", 104.5654, 43.766443332);
35
36 printf("\n");
37
38 // print integers `printf` and `min_printf`
39 min_printf(":%s: :%4.3s:\n", "Hello, World!", "Hello, World!");
40 printf(":%s: :%4.3s:\n", "Hello, World!", "Hello, World!");
41
42}
void min_printf(char *fmt,...)
min_printf is the function same as printf
Definition min_printf.h:299
Here is the call graph for this function: