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-02-2030/Digby_Real_Estate/Fundamentals/count.c
T
2026-01-29 18:42:21 +01:00

29 lines
410 B
C

#include <stdlib.h>
//#include <stdio.h>
int *count(int n){
if (n < 1) return NULL;
int *p = malloc(n);
if(p == NULL) return NULL;
while (n != 0){
*(p + n-1) = n;
n --;
}
return p;
}
/*
int main(){
int *rslt = count(5);
int index = 0;
while(*(rslt + index)){
printf("%i", *(rslt + index));
index ++;
}
free(rslt);
}*/