I edited the formatting of the text again to suit all types of data together.
Note: I chose the file to be "kitten.text" instead of "datasize.dat" because I cannot open the latter in my computer to show you the main purpose of the program.
And here is my final code with a screenshot.
#include <stdio.h>
int main() {
FILE* cat = fopen("kitten.txt", "w") ;
fprintf(cat, "%-18s", "Data type") ;
fprintf(cat, "%7s\n", "Size") ;
fprintf(cat, "%-18s", "char") ;
fprintf(cat, "%7d\n", sizeof(char)) ;
fprintf(cat, "%-18s", "unsigned char") ;
fprintf(cat, "%7d\n", sizeof(unsigned char)) ;
fprintf(cat, "%-18s", "short int") ;
fprintf(cat, "%7d\n", sizeof(short int)) ;
fprintf(cat, "%-18s", "unsigned short int") ;
fprintf(cat, "%7d\n", sizeof(unsigned short int)) ;
fprintf(cat, "%-18s", "int") ;
fprintf(cat, "%7d\n", sizeof(int)) ;
fprintf(cat, "%-18s", "unsigned int") ;
fprintf(cat, "%7d\n", sizeof(unsigned int)) ;
fprintf(cat, "%-18s", "long int") ;
fprintf(cat, "%7d\n", sizeof(long int)) ;
fprintf(cat, "%-18s", "unsigned long int") ;
fprintf(cat, "%7d\n", sizeof(unsigned long int)) ;
fprintf(cat, "%-18s", "float") ;
fprintf(cat, "%7d\n", sizeof(float)) ;
fprintf(cat, "%-18s", "double") ;
fprintf(cat, "%7d\n", sizeof(double)) ;
fprintf(cat, "%-18s", "long double") ;
fprintf(cat, "%7d\n", sizeof(long double)) ;
fclose(cat) ;
return 0 ;
}