Skip to content

Instantly share code, notes, and snippets.

@itmir913
Last active May 29, 2021 13:53
Show Gist options
  • Select an option

  • Save itmir913/ab11f77f252ecbe6629ef277a9555e15 to your computer and use it in GitHub Desktop.

Select an option

Save itmir913/ab11f77f252ecbe6629ef277a9555e15 to your computer and use it in GitHub Desktop.
[1차원 배열 동적할당] C언어 동적 배열 할당 #배열 #동적할당
#include <stdlib.h>
int *createArray(int num) {
int *arr = (int *) malloc(sizeof(int) * num);
for (int i = 0; i < num; i++) {
*(arr + i) = i;
}
return arr;
}
int main(void) {
int *arr = createArray(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment