Created
October 18, 2019 17:49
-
-
Save jaqque/10ca0dcfcc47ab4aaab1cbc44a1f96e0 to your computer and use it in GitHub Desktop.
squeaky's test.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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