Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

hi Google and learn \"Pascal\'s triangle\". Create a function of the following p

ID: 3547267 • Letter: H

Question

hi

Google and learn "Pascal's triangle". Create a function of the following prototype int **getPascalTriangle(int n) which returns a Pascal's triangle of height n that is stored in a pointer to pointers to int. Note the "height" of a Pascal's Triangle refers to the number of rows in the triangle. For example, the following Pascal's triangle has height 4. In the returned pointer to pointers to int, the allocated memory to store numbers in the triangle should be exactly equal to the number of numbers in the triangle. (This is why two dimensional arrays are not efficient for this purpose). Create a function of the following prototype void writePascalTriangle(char *filename, int heightof Triangle,int **triangle) that writes a Pascal's triangle into a text file with specified file name, and a function of the following prototype void readPascalTriangle(char *filename, int *heightOfTriangle, int **triangle) that read Pascal's triangle from the file written by the writing function you developed. (Why in the prototype, is heightOfTriangle of type "int *" rather than "int?) The following function is used to create binary files homework7Mac.bin and homework7Windows.bin, which accompany this document. Void writeBinaryFile(char*filename, char *comment, int numberOf doubles, double *double *doubles, int numberOfInts, int *ints) { FILE *fp; int charArrayLength; charArrayLenght=strlen (comment)+1; fp=fopen ( file name, "wb"); fwrite(&charArrayLenght;, sizeo f ( int ),1, fp); fwrite ( comment, sizeof ( char ) , charArrayLengh, fp); fwrite (&numberOfDoubles;, sizeof ( int) , 1, fp); fwrite ( doubles, sizeof ( double ), numberOfDoubles, fp); fwrite (&numberOfInts;, sizeof ( int ) , 1, fp); fwrite ( ints, sizeof ( int ) , numberOfInts, fp); fclose ( fp ); } The file homework7Mac.bin is created by a program calling this function compiled on MacOS, and the file homework7Windows.bin is created by a program calling this function compiled on windows. The data contained in these two files are identical, but the two files could be different due to the difference in the system on which the files are generated. You are to write a function that reads the binary file. You should choose one of the two files to read, not both ( which depends on the system you are using). After you are able to read the file, provide, as comment ( in the programming sense ), the content of the file.

Explanation / Answer

you can implement pascal triangle by using powers of 11.

11^0 = 1

11^1 = 11

11^2 = 121

11^3 = 1331...

and so on.

store the result in a variable and use modulus operator to get single values to print the triangle..