Add pointer support and improve debug and valgrind in Makefile
This commit is contained in:
14
main.c
14
main.c
@@ -6,7 +6,7 @@
|
||||
/* By: baco <baco@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/04/13 06:58:46 by gbaconni #+# #+# */
|
||||
/* Updated: 2022/04/13 07:54:40 by gbaconni ### lausanne.ch */
|
||||
/* Updated: 2022/04/15 17:19:36 by gbaconni ### lausanne.ch */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -75,10 +75,14 @@ int main(int argc, char *argv[])
|
||||
int d;
|
||||
char c;
|
||||
char *s;
|
||||
int x;
|
||||
void *ptr;
|
||||
|
||||
d = 0;
|
||||
c = '\0';
|
||||
s = "";
|
||||
x = 42;
|
||||
ptr = &x;
|
||||
(void)s;
|
||||
if (argc > 1)
|
||||
{
|
||||
@@ -107,6 +111,14 @@ int main(int argc, char *argv[])
|
||||
ret = ft_printf(format, s);
|
||||
printf(": %d = ft_printf(\"%s\", \"%s\")\n", ret, format, s);
|
||||
}
|
||||
else if (ft_strlen(argv[2]) == 0)
|
||||
{
|
||||
s = argv[2];
|
||||
ret = printf(format, ptr);
|
||||
printf(": %d = printf(\"%s\", \"%s\")\n", ret, format, s);
|
||||
ret = ft_printf(format, ptr);
|
||||
printf(": %d = ft_printf(\"%s\", \"%s\")\n", ret, format, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error: invalid argument\n");
|
||||
|
||||
Reference in New Issue
Block a user