This commit is contained in:
LinlyBoi
2023-08-21 13:41:10 +03:00
parent 883e8b5b9a
commit bc32277deb
3 changed files with 8 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ int _printf(const char *format, ...)
va_start(args, format);
identifiers = _contains(format, '%');
BUFF_SIZE = _strlen(format) - identifiers;
BUFF_SIZE = _strlen(format) - (identifiers * 2);
buffer = malloc(BUFF_SIZE);
if (!format) /* No string. No laundry */
@@ -38,7 +38,7 @@ int _printf(const char *format, ...)
break;
case 'c': /* add 1 byte and i++ */
c = (char) va_arg(args, int);
*(buffer + buff_idx) = c;
BUFF_SIZE += 1;
buff_idx += 1;
break;

View File

@@ -8,7 +8,7 @@
int main(void)
{
char c = 97;
char c = 'c';
_printf("cat: %c", c);
return (0);

View File

@@ -1,17 +1,21 @@
#include "../main.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
/**
* main - why does this not work! I know!
* Return: 0...unless?
*/
int main(void)
{
char *str, *str2;
char *str, *str2, c;
str = "hello";
str2 = " world!\n";
str = _strcpy(str, str2);
c = 'c';
printf("%s", str);
write(1, &c, 1);
return (0);
}