Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
},
{
"name": "includePath",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"C_Cpp.errorSquiggles": "Disabled"
}
43 changes: 43 additions & 0 deletions _printf.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "main.h"

/**
* _printf - produces output according to a format
* @format: format string containing the characters and the specifiers
* Description: this function will call the get_print() function that will
* determine which printing function to call depending on the conversion
* specifiers contained into fmt
* Return: length of the formatted output string
*/
int _printf(const char *format, ...)
{
register short len = 0;
int (*printFunc)(va_list, mods *);
mods prefixes = PF_INIT;
const char *p = format;
va_list arguments;

va_start(arguments, format);
assert(invalidInputs(p));
for (; *p; p++)
{
if (*p == '%')
{
p++;
if (*p == '%')
{
len += _putchar('%');
continue;
}
while (get_flags(*p, &prefixes))
p++;
printFunc = get_print(*p);
len += (printFunc)
? printFunc(arguments, &prefixes)
: _printf("%%%c", *p);
} else
len += _putchar(*p);
}
_putchar(FLUSH);
va_end(arguments);
return (len);
}
5 changes: 5 additions & 0 deletions main.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifndef MAIN_H
#define MAIN_H
#include <stdarg.h>

#endif