Activity 27.3.
Please write the function
createDigit() which receives an integer (0-9) as an argument and which creates space in memory for a digit of type digit_t. The function should store the integer passed into it in this newly created digit and then return the address of this digit to the calling function. The function should furthermore initialize the pointer next as the NULL pointer, just to be safe.
Compile and run the code below in your own C environment.
#include <stdio.h>
#include <stdlib.h>
struct digit {
int num;
struct digit *next;
};
typedef struct digit digit_t;
digit_t *createDigit(int);
int main(void) {
digit_t *numberptr;
numberptr = createDigit(5);
printf("We are storing the digit %d.\n", numberptr->num);
free(numberptr);
return 0;
}
digit_t *createDigit(int dig) {
}

