I need to code a small/simple database application using C.
My idea is to use a B-Tree to store the items of each table. The problem I am facing is that tables need to be flexible to hold an unknown number of columns, and each column can be either a STRING or an INT. For example, with this command:
CREATE TABLE student (STRING name, INT age)
I would need to create a table that holds a string and an integer. With this command instead:
CREATE TABLE grade (INT grade1, INT grade2, INT grade3)
I would need to create a table that holds three integers.
How can achieve such flexibility?
My only idea so far is to create a struct with several unions inside it, where each union can be either a STRING or an INT. I would also need to put a lot of unions inside, to be sure to accommodate all the columns requested by the table. For example:
Is there a better way to do this?
How To Make A Table In Dev C 4
How To Make A Table In Dev C 2017
Example to generate the multiplication table of a number (entered by the user) using for loop. To understand this example, you should have the knowledge of following C programming topics: Example 1: Display Multiplication table up to 10. This program above computes the multiplication table up to 10 only.