In my last tutorial on C Hello word program, we learnt how to create a simple C program and went ahead to describe C program structure.
C is regarded as a typed language. C compiler must know the type of data that want memory space in order to know the amount of space to allocate to the data.
There are some programming languages that are not strictly type. In this case, the compiler or interpreter uses type inference to understand the data type your are assigning space to.
Besides allocation of memory space, it also indicate the nature of the variable and the kind of operations the variable can perform.
In C programming, we have the following int, char, float and double as the fundamental or primitive data types.
Apart from primitive data type, there is derived data type which is a combination modifiers and primitive data types
Before we look at each primitive data types, the table below shows the amount of memory space each data type can occupy.
Remember that there is a minimum number of bytes a data type can take but this can vary with compilers and operate system.
C programming language contains the following modifiers – short, long, unsigned, signed. Not all combinations of types and modifiers are available
The primitive that types can only hold a single value at a time. When you want to group or store values of the data type then we need to use derived data types.
Derived data type is like a collection of values of the same type. In C programming, this is represent with following types – Pointer types, Array types, etc.
User define data types are user created data type which can contain similar data types or a combination of different data types.
Sooner or later you will come in contact with C language void type. Void type is more like a generic or universal type.
C programming has a library function called sizeof(). This function returns the memory space any data type passed to it will occupied.
Working with C programming language implies more often than not, you will be allocating memory spaces and freeing memory space when not in used.
With this in mind, you will found usage of sizeof() function very important as your C programming knowledge becomes better.
We have look at C language data types. We will diverge a bit to briefly discuss data type qualifiers in C.
Const is a quantifier for a data type variable which adds the variable in a constant region of the memory in turn the value assigned to it cannot be changed.
Volatile quantifier on the other hand is rarely used in C programming but in its usage, it notifies the compiler that this variable can be modify outside the program control.
Feel free to read more on this topics because it is something that you will use in also every code you will in C.
We are going to C language const in our next tutorial. If your are already, click the button bellow.
This article describes how to set up database replication in MySQL. MySQL replication allows you to have an exact copy of a database from a master server on another server (slave), and all updates to the database on the master server are immediately replicated to the database on the slave server so that both databases are in sync. This is not a backup policy because an accidentally issued DELETE command will also be carried out on the slave; but replication can help protect against hardware failures.
Here we will show how to replicate the database exampledb from the master with the IP address 192.168.1.100 to a slave. Both systems (master and slave) are running Microsoft Windows; however, the configuration should apply to all distributions with little or no modification.
Both systems have MySQL 5.0 installed, and the database exampledb with tables and data is already existing on the master, but not on the slave.
Now we have to tell MySQL to write logs (these logs are used by the slave to see what has changed on the master), which log file it should use, and we have to specify that this MySQL server is the master. Put the following lines into the file C:\Program Files\MySQL\MySQL Server 5.0\my.ini below the [mysqld] line:
Then we restart the MySQL service by running the following commands in the Command Prompt (located at Start -> All Programs -> Accessories -> Command Prompt):
Then we need to change directory to our MySQL bin directory by running the following command in Command Prompt:
(Replace <password> with the real password for the MySQL user root! Important: There is no space between -p and <password>!)
Next we have to tell MySQL on the salve that it is the slave, that the master is 192.168.1.100. Therefore we add the following lines to C:\Program Files\MySQL\MySQL Server 5.0\my.ini below the [mysqld] line:
That's it! Now whenever exampledb is updated on the master, all changes will be replicated to exampledb on the slave.
DOG SIGHTING ALERT! North Indianapolis! A tan boxer mix was spotted near Keystone & Kessler near N. Kessler Manor!
DOG SIGHTING ALERT! SEside INDPLS! He looks like a chug at Union & Pleasant Run Parkway by Garfield Park