Skip to content

Instantly share code, notes, and snippets.

@jaqque
Created October 18, 2019 17:49
Show Gist options
  • Save jaqque/10ca0dcfcc47ab4aaab1cbc44a1f96e0 to your computer and use it in GitHub Desktop.
Save jaqque/10ca0dcfcc47ab4aaab1cbc44a1f96e0 to your computer and use it in GitHub Desktop.
squeaky's test.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n=5;
int* arr = (int*) calloc(n, sizeof(int));
int* test = malloc(n*sizeof(int));
for (int i=0; i<n; i++) {
// fprintf(stderr,"reading "")
scanf("%d", &arr[i]);
// fprintf(stderr,"got %d\n", arr[i]);
}
arr=test;
for (int i=0; i<n; i++) {
printf("%d\n", *test);
test++;
}
free(test);
free(arr);
// for (int i=0; i<n; i++) {
// printf("%d\n", arr[i]);
// }
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment