Skip to content

Latest commit

 

History

History
29 lines (19 loc) · 1.35 KB

README.md

File metadata and controls

29 lines (19 loc) · 1.35 KB

Project: atlas-printf

Description: Our task was to write a local version of the standard library’s printf function. The original function’s name stands for print formatted, indicating its ability to handle printing text with specific formatting rules applied. Printf produces an output based on a format string. The string can contain both plain text and special formatting codes; initiated by the presence of the special character ‘%’. Following the percent symbol are the type indicators telling the function what datatype format is needed for that point in the string. As follows…

%c - character %s - string %d - decimal integer %i - integer

While the original printf uses a switch-case, our version calls a function that iterates through an array of structs. This emulates the behavior of a switch-case.

_printf will return the number of characters printed, not including the '\0'

Flowchart: Attached below is a flowchart following the step by step process in which our Printf mimic runs. printf-presentation-flowchart

Following is an example of _printf applied in a hypothetical main function. #include "main.h"

int main(void)
{
	int len;

	len = _printf("outputs: %c; %s; %d; %i\n", 'A', "tqbfjotld", 98, INT_MIN);

	return (int);
}

Authors: Chepe & Torin