Giter Site home page Giter Site logo

printf's Introduction

0x10. C - Printf

Author

John Cook - github

John Cook - Twitter

John Cook - Linkedin

John Cook's year one portfolio project

Van Phan - github

Van Phan - Twitter

Van Phan - Linkedin

Van Phan's year one portfolio project

About the Authors

Van is a great guy who is very smart, his code is clean and he works hard. He is easy to work with too. During this project, our first team project we where all nervous. looking back I would not have had it any other way. Van is a great software engineer. I would happily hire Van if I where in a position to do so.

John is a machine learning engineer now, fluent in Tensorflow, Keras, numpy and many other machine learning libraries. He is very good at python, and has experience in reinforcement learning, supervised learning, and unsupervised learning.

Synopsis

We created a simple function of printf function to print input data.

The prototype that we used:

*int _printf(const char format, ...);

format is a character string. The format string is composed of zero or more directives.

alt text


Description

The _printf() function is built based on our _putchar(). This _printf() write output to stdout, the standard output stream. The function returns the number of characters printed (excluding the null byte used to end output to strings) or return -1 if the function fail. This project was difficult due to the fact that at the time we where new to coding. We could probably go back and implement all the features of printf but the ones we have are adequate to demonstrate the process.

_printf() function creates output based on the following format specifier:

Format Specifiers and Example
Function Format specifier Usage Example
print_c %c Print a character _printf("%c", 'h') _Prints character h
print_s %s Print a string _printf("Hello %s\n", "World") Prints "Hello World" followed by a new line
print_i %i & %d Print an integer _printf("%d and %i\n", 777, 888) printf two decimal number 777 & 888 followed by a new line

File list

File name Description
_putchar.c create own putchar function
holberton.h Header file contains all header and prototype
op_type.c Create the structure of all format and their function
print_number.c Create print_i function and its helper functions
type_format.c Contains print_c and print_s functions.
printf.c The main file to execute all function

Compilation

All the files were compiled on Ubuntu 14.04 LTS

All programs and functions were compiled with gcc 4.8.4 using the flags -Wall -Werror -Wextra and -pedantic.

printf's People

Contributors

johncook17 avatar vdphan avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.