This repository has been archived on 2026-05-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
prog-103-p-03-2030/AcquiringLand/Fundamentals/bad_practice.c
T
2026-02-09 03:43:16 +01:00

29 lines
491 B
C

#include <stdlib.h>
#include <stdio.h>
int *division(int input, int by)
{
//int value = input / by;
if (by != 0){
//int value = input / by;
}
else
return
//int value = 0;
int *ptr = &value;
return ptr;
}
int main(void)
{
int *ptr1 = division(42, 2);
printf("the 1st value is %d\n", *ptr1);
int *ptr2 = division(12, 0);
printf("the 2nd value is %d\n", *ptr2);
free(ptr1);
free(ptr2);
return EXIT_SUCCESS;
}