Created
September 18, 2016 02:27
-
-
Save minostro/b0d6456e8a888ddbc495536590bdbb06 to your computer and use it in GitHub Desktop.
This file contains 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> | |
int* initialize_array(int n) { | |
int array[n]; | |
for(int i=0; i<n; i=i+1){ | |
array[i] = i+1; | |
} | |
return array; | |
} | |
int main(int args, char *argv[]) { | |
int array_size; | |
printf("Enter the array size:\n"); | |
scanf("%d", &array_size); //user has to enter the size of the array | |
int* my_array = initialize_array(array_size); //a new array will be initialized | |
for(int i=0; i<array_size; i=i+1){ | |
printf("value: %i\n", my_array[i]); //display current value | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment