rendered paste body#include <malloc.h>#include <math.h>#include <stdlib.h>#include <stdio.h>struct lijst{double getal;struct lijst* volgend;};void split(struct lijst *hoofd, int** n, float** frac);int telAantal(struct lijst *hoofd);double geefGetal(struct lijst* hoofd, int i);void printUit(struct lijst *hoofd);void voegToeS(struct lijst **hoofd,float j);int main(void){int i;int **n = NULL;float **frac = NULL;struct lijst *lijst1 = NULL;voegToeS(&lijst1,5.8);voegToeS(&lijst1,8.4);voegToeS(&lijst1,9.23);voegToeS(&lijst1,1.52);voegToeS(&lijst1,0.4);printUit(lijst1);split(lijst1,n,frac);for(i=0; i<5;i++) printf("\n%d \t %.3lf",*n[i],*n[i]);while(1);return 0;}void split(struct lijst *hoofd,int **n, float **frac){ int i,aantal = telAantal(hoofd); float *reeel = NULL; int *geheel = NULL; reeel = (float*) malloc(sizeof(float *) * aantal); geheel = (int*) malloc(sizeof(int *) * aantal); for(i=0; i < aantal; i++){ reeel[i] = modf(geefGetal(hoofd,i),geheel+i); printf("%d",reeel[i]); } //*n = *geheel; //*frac = *reeel;}double geefGetal(struct lijst *hoofd,int i){int j = 0;while(j < i){ hoofd = hoofd->volgend; j++; }return hoofd->getal;}int telAantal(struct lijst *hoofd){int i = 0;while(hoofd != NULL){ hoofd = hoofd->volgend; i++; }return i;}void voegToeS(struct lijst **hoofd,float j){ struct lijst *hulp = *hoofd; struct lijst *nieuw = (struct lijst *) malloc ( sizeof(struct lijst*)); nieuw->getal = j; nieuw->volgend = NULL; if(hulp == NULL) *hoofd = nieuw; else { while(hulp->volgend != NULL) hulp = hulp->volgend; hulp->volgend = nieuw; }}void printUit(struct lijst *hoofd){ while(hoofd != NULL) { printf("\n%.3lf\t\t%p",hoofd->getal,hoofd->volgend); hoofd = hoofd->volgend; }}