Langsung ke konten utama

Unggulan

Cara Mencegah Inflasi

Pengertian Inflasi Menurut Kamus Besar Bahasa Indonesia, inflasi adalah kemerosotan nilai uang (kertas) karena banyaknya dan cepatnya uang (kertas) beredar sehingga menyebabkan naiknya harga barang-barang. Bank Indonesia  memberikan definisi, inflasi adalah kenaikan harga barang dan jasa secara umum dan terus menerus dalam jangka waktu tertentu. Sedangkan menurut Badan Pusat Statistik, inflasi adalah kecenderungan naiknya harga barang dan jasa pada umumnya yang berlangsung secara terus menerus. Inflasi adalah hal yang biasa terjadi pada negara yang sedang berkembang, yang mengalami kenaikan harga secara meluas dan simultan. Inflasi adalah gejala ekonomi, yang hampir bisa dipastikan tidak mungkin bisa dihindari. Yang bisa dilakukan oleh suatu negara adalah mengendalikannya. Jenis-Jenis Inflasi 1. Inflasi ringan Skala ringan dalam inflasi adalah yang masih dalam tingkat mudah dikendalikan. Biasanya tidak memberikan efek yang terlalu mengganggu stabilitas ekonomi suatu negara. Parameterny

Learning Structure in C

C structures are special, large variables which contain several named variables inside. Structures are the basic foundation for objects and classes in C++. Structures are used for:
  • Serialization of data
  • Passing multiple arguments in and out of functions through a single argument
  • Data structures such as linked lists, binary trees, and more
The most basic example of structures are points, which are a single entity that contains two variables - x and y. Let's define a point in a two-dimensional point:

struct point {
    int x;
    int y;
}

Now, let's define a new point, and use it. Assume the function draw receives a point and draws it on a screen. Without structs, using it would require two arguments - each for every coordinate:

/* draws a point at 10, 5 */
int x = 10;
int y = 5;
draw(x, y);

Using structs, we can pass a point argument:

/* draws a point at 10, 5 */
struct point p;
p.x = 10;
p.y = 5;
draw(p);

To access the point's variables, we use the dot . operator.

Typedefs

Typedefs allow us to define types with a different name - which can come in handy when dealing with structs and pointers. In this case, we'd want to get rid of the long definition of a point structure. We can use the following syntax to remove the struct keyword from each time we want to define a new point:

typedef struct {
    int x;
    int y;
} point;

This will allow us to define a new point like this:

point p;

Structures can also hold pointers - which allows them to hold strings, or pointers to other structures as well - which is their real power. For example, we can define a vehicle structure in the following manner:

typedef struct {
    char * brand;
    int model;
} vehicle;

Since brand is a char pointer, the vehicle type can contain a string (which, in this case, indicates the brand of the vehicle).

vehicle mycar;
mycar.brand = "Ford";
mycar.model = 2007;

Reference : http://www.learn-c.org/en/Structures

Komentar

Postingan Populer