Wednesday, November 28, 2018

Structures and Unions & Memory Allocation

Here is what i got from this week's session:

Structure is much likely an array, but it runs on a logic called "record". It is used to make an array (two dimensional usually) in order.

Here's an example of how it's done:

struct data{
   char name[100];
   char NIM[10];
   int age;
   char campus[100];
}student[100];

Once we pick a certain index, the data structure will make it easier to find the data connected by each other data inside it.

Example: input 1, it will print out

a student's name, NIM, age, and campus "accordingly".


No comments:

Post a Comment