re
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#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);
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user