Algorithm & programming part VI (Data Structure)

This is part 6th of our meeting. Part 6th will focus on struct (in C ) or record (in pascal). But, before talking about that we have to talk about main (real) type and defined type. Main type is standard types which has been prepared by certain programming languages. Defined type is combination of certain types which is made by programmer by using certain programming language. Therefore, we can conclude that every programmer can modify their own type for certain variables in a program.

Alhamdulillah, now we have known about main and defined type. All of that has important effect in making record/ struct. Let’s go to record. Actually, record is a group of elements from array. By using record , we can make a variable with combination of different types. However, there are differences between C and PASCAL about record. In C we call struct in PASCAL we call record. But, they both are same in function.

Below is examples :


#include <stdio.h>

void input();
void appearance();
 char nama[20];
 int nrp;

//typedef struct mahasiswa data;
//data profil[20];
int a;
int main()



void input(void){

int b;

printf("Masukkan jumlah data total = ");scanf("%d",&a);
 for (b=1;b<=a;b++){
 printf("Masukkan nama mahasiswa ke-%d = ",b);scanf("%s",mahasiswa.nama);
 printf("Masukkan nrp Mahasiswa ke-%d  = ",b);scanf("%d",&mahasiswa.nrp);

void appearance(void){
int a,b;
puts("|No  |        Name            |        Nrp        |\n");
 for (b=1;b<=a;b++){
 printf("  %d\t\t  %s\t\t\t\t  %d\t\t\t\n",b,mahasiswa->nama,mahasiswa->nrp);

Oh ya…i forget that inside C programming language also there is something same like struct but, in some case it is different in it’s name and function also in it’s use. It is Called union. Union is not only work in single structured variable but also work in multi structured variable. But, in this case, I don’t want to give you example about that.


2 thoughts on “Algorithm & programming part VI (Data Structure)

  1. Fariz 04/02/2011 at 11:11 pm Reply

    Gak bisa mas code nyaa

    • xaxioza 04/03/2011 at 5:18 pm Reply

      Code program APA ?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: