Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*********************************
- * Class: MAGSHIMIM C2 *
- * Week: *
- * Name: *
- * Credits: *
- **********************************/
- #include <stdio.h>
- #include <stdlib.h>
- void scanGrades(int * arr, int length);
- int main(void)
- {
- int numOfGrades = 0;
- while (numOfGrades <= 0)
- {
- printf("Enter number of grades: ");
- scanf("%d", &numOfGrades);
- }
- int * grades = malloc(sizeof(int) * numOfGrades);
- scanGrades(grades, numOfGrades);
- int i = 0;
- for (i = 0; i < numOfGrades; i++)
- {
- printf("%d ", grades[i]);
- }
- getchar();
- getchar();
- return 0;
- }
- void scanGrades(int * arr, int length)
- {
- int i = 0;
- for (i = 0; i < length; i++)
- {
- printf("Enter grade %d: ", i + 1);
- scanf("%d", &arr[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement