10 Februari, 2018

C Programming | Know your variables.

Hello, geeks. As I promised in the last post, today I would like to show you stuffs about variables and formatted outputs.

First, variable is some part of memory which is reserved for some value. In other words, variable is a place with an address to assign your value into. Variables always carry something like an identifier, which is known as data type. In C, there are a lot of data types, but for now, I will only present to you guys three common types of data.

1. Integer (int)
Integer can only contain positive and negative numbers. Integer can be represented by doing this.

int number;
int number1 = 1;
int number2 = 2, number3 = 3;
int number4, number5;

number4 = number5 = 0;


You can also assign a character into an integer. Why? Because, character is also a number to begin with, known as ASCII Numbers. For example, A's ASCII is 65, so if you assign A into an integer, int will save the value of its ASCII number, which is 65.

int asci = 'A'; //asci's value will be equal to A's ASCII number.


2. Character (char)
Char can only be assigned by a single character. But, you can also assign them with ASCII Number that represents a character. For example, as I mentioned above, A carries an ASCII number which is 65. So, to assign A into a variable, you can do it by

char mychar = 'A';
char mychar1 = 65; // The value of mychar is equal to value of mychar1.


The difference between integer and char is how computer present them to user. Integer will be presented as numbers, meanwhile char as character itself.


3. Float (float)
Float consists decimal numbers. 0.5, 3.14, 5/2 is float. We can also assign integers into float. So we can assign these values by

float float1 = 0;
float float2 = 0.5;
float float3 = 3.14, float4 = 5/2;


So variables is a place for value to remains. You need three of them to grow, so you better understand them first before you take another step. Int represents only integers, char represents only a single character, and float carries all of numbers and turn them into decimal shape.

Now, we already know our variables. In the next post, I would talk about the formatted outputs. Make sure you keep your head cool, the path isn't gonna be easy, but we can always do it! See ya!

Best regards, Ryu.

If you have some problems about programming, feel free to contact me via e-mail. 
E-mail: ryutaroushirogane@gmail.com
TheCreat0r of Omnipotent.

09 Februari, 2018

C Programming | Getting started.

Halo, guys. It's been a long time indeed, but from now on, I'm going to keep posting again. Few years back, I used to bring forth stuff about SAMP or PAWNO. But, as the time runs, I've been learning various programming languages, such as C, C++, JAVA, PYTHON, PHP, HTML, CSS, JAVASCRIPT and many more. So, I would post some tutorials about them, but from now I'll be posting stuff about C first. So, let's get started!

C is considered as the fastest programming language. Why? Because C in the hierarchy, is the closest to the machine language, but C is also close to human language. That's why C is said to be the fastest language. But, C is also a pretty hard language due to some inhuman language, it makes C pretty hard to understand. That's why some seniors said, you can do anything if you have mastered C. PAWNO is C-based language, so the codes will be similar to C.

To program in C, you may use any IDE such as Microsoft Visual Studio(VCExpress), CodeBlocks, Komodo and many more. But, I prefer to code in GCC since I'm using Kali Linux. Okay, now let the lesson begins!

The very first step than you have to understand is the input/output. Program needs an input and will result outputs. We are going to start with the output first.

#include <stdio.h>

int main()
{
printf("TheCreat0r is here!"); //printf("Your text here");
}


In C, our main include is stdio.h. Because, stdio is a standard input and output module which is used by C Programmers to do input and output. We call a function named printf, stands for print format, and is used to show outputs to the users. So whenever you want to show outputs, call this function.

Okay, maybe that's it for today, guys. In the next occasion, I will talk about variables and formatted outputs. Make sure you keep your head cool, it's not easy, but we can always do it! See ya!

Best regards, Ryu.
If you have some problems about programming, feel free to contact me via e-mail. 
E-mail: ryutaroushirogane@gmail.com
TheCreat0r of Omnipotent.