{"id":20287030,"url":"https://github.com/codewithsegnet/printf","last_synced_at":"2025-07-02T12:32:53.806Z","repository":{"id":61615568,"uuid":"553334486","full_name":"CodewithSegNet/printf","owner":"CodewithSegNet","description":"TEAM PROJECT","archived":false,"fork":false,"pushed_at":"2023-02-08T10:45:26.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-07T19:45:43.244Z","etag":null,"topics":["c","shell"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodewithSegNet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-18T04:00:21.000Z","updated_at":"2023-02-08T10:46:17.000Z","dependencies_parsed_at":"2024-11-14T14:39:06.538Z","dependency_job_id":"a2bd4c05-9913-4c26-a7ae-4e1a627d6e45","html_url":"https://github.com/CodewithSegNet/printf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CodewithSegNet/printf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodewithSegNet%2Fprintf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodewithSegNet%2Fprintf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodewithSegNet%2Fprintf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodewithSegNet%2Fprintf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodewithSegNet","download_url":"https://codeload.github.com/CodewithSegNet/printf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodewithSegNet%2Fprintf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263140646,"owners_count":23419922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","shell"],"created_at":"2024-11-14T14:37:54.517Z","updated_at":"2025-07-02T12:32:53.783Z","avatar_url":"https://github.com/CodewithSegNet.png","language":"C","readme":"# Printf.\n```` c\nint printf ( const char * format, ... );\n````\nThis is the first group project that we have at Alx Software Engineering Program, which consists of replicating the **[printf (3)](http://man7.org/linux/man-pages/man3/printf.3.html)** function of language c, calling it this way **_printf.**\n\nThis function is part of the standard library **\u003ccstdio\u003e** and to use it we must specify the header file **\u003cstdio.h\u003e**.\n\nWrites the C string pointed by format to the standard output **(stdout)**. If format includes format specifiers (subsequences beginning with **%**), the additional arguments following format are formatted and inserted in the resulting string replacing their respective specifiers.\n### Parameters\n \u003e **format** -\u003e C string that contains the text to be written to stdout.\n \nWhere the specifier character at the end is the most significant component, since it defines the type and the interpretation of its corresponding argument:\n Specifier | Output | Example\n------------ | ------------- |-----------\n c | Character | A\n s | String of characters |\n % | A % followed by another % character will write a single % to the stream| %\n  i and d | Signed decimal integer | 98 \n b | Unsigned binary | 10101\n u | Unsigned decimal integer | 98\n o | Unsigned octal | 5523\n x | Unsigned hexadecimal integer (lowercase) | 36264eb\n X | Unsigned hexadecimal integer (uppercase) | 36264EB\n r | Reversed string | gnirts |\n R | Rot13 string | cevags\n##### Return Value.\nOn **success**, the **total number** of characters written is returned.\nIf a writing error occurs, the error indicator (ferror) is set and a negative number is returned.\n \n## The tasks.\n-[x] **I'm not going anywhere. You can print that wherever you want to. I'm here and I'm a Spur for life.** \nWrite a function that produces output according to a format.\n\n- Prototype:``int _printf(const char *format, ...);``\n- Returns: the number of characters printed (excluding the null byte used to end output to strings)\n- write output to stdout, the standard output stream\n- format is a character string. The format string is composed of zero or more directives. See man 3 printf for more detail. You need to handle the following conversion specifiers:\n-- ``c``\n-- ``s``\n--  ``%``\n\n -[x] **Education is when you read the fine print. Experience is what you get if you don't**\nHandle the following conversion specifiers:\n-- ``d``\n--``i``\n### [Man_3_printf.](https://photos.app.goo.gl/pY1W7jWLFGHLPa3S6)\n## Functions we use.\n\n````c\nint _putchar(char c); /*writes the character c to stdout */\nint _printf(const char *format, ...);/* function that produces output according to a format.*/\nint print_char(va_list c);/*writes the character c to stdout */\nint print_string(va_list s);/*writes the character c to stdout */\nint print_int(va_list i);/*function that prints an integer */\nint print_dec(va_list d);/* function that prints an decimal*/\n````\n## [Flowchart.](https://photos.app.goo.gl/5SQMnxrmd7nkLr3a6)\n## How to use.\n### Complilation\nAll of the ``.c`` files along with a main.c file are to be compiled with ``gcc 4.8.4`` on Ubuntu 14.04 LTS with the flags ``-Wall Werror`` ``-Westra`` and ``-pedantic.``\n\nThe files will be compiled this way:\n- ``gcc -Wall -Werror -Wextra -pedantic *.c``\n#### Use.\nIn the ``main.c`` file, use the ``_printf`` function like so:\n```c\n#include \"main.h\"\n/**\n * main - main function of program\n * Return: always 0\n */\nint main(void)\n{\n\tint num;\n\tchar *string;\n\t\n\tnum = 98;\n\tstring = \"Hello, BEST School!\"\n\t_printf(\"%s is %i.\\n\", string, num);\n\treturn (0);\n}\n```\n```{bash}\nlinux\u003e$  gcc -Wall -Werror -Wextra -pedantic *.c -o print_program\nlinux\u003e$  ./print_program\nHello, BEST School is 98.\nlinux\u003e$\n```\n## Contributor\n- [Olusegun Emmanuel](https://github.com/CodewithSegNet/printf/)\n- [Florence Idowu](https://github.com/FlorenceIdowu/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithsegnet%2Fprintf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithsegnet%2Fprintf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithsegnet%2Fprintf/lists"}