char insertion poopoo
This commit is contained in:
6
printf.c
6
printf.c
@@ -15,6 +15,7 @@ int _printf(const char *format, ...)
|
||||
unsigned int identifiers = _contains(format, '%');
|
||||
unsigned int BUFF_SIZE = _strlen(format) - (identifiers * 2);
|
||||
char *buffer, *next;
|
||||
char c;
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
@@ -36,6 +37,11 @@ int _printf(const char *format, ...)
|
||||
fmt_idx += 2;
|
||||
break;
|
||||
case 'c': /* add 1 byte and i++ */
|
||||
c = va_arg(args, int);
|
||||
*(buffer + buff_idx + 1) = c;
|
||||
BUFF_SIZE = _strlen(buffer);
|
||||
buff_idx += 1;
|
||||
fmt_idx += 2;
|
||||
break;
|
||||
case '%': /*add 1 byte*/
|
||||
break;
|
||||
|
||||
15
tests/char_print.c
Normal file
15
tests/char_print.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "../main.h"
|
||||
|
||||
/**
|
||||
* main - testing printing of only char
|
||||
*
|
||||
* Return: deadth
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char c = 97;
|
||||
|
||||
_printf("cat: %c", c);
|
||||
return (1);
|
||||
}
|
||||
Reference in New Issue
Block a user