Learning C Programming – C Data Types, I think.

No, no. What do you mean by I am taking this from Wikipedia? Of course not, why are you accusing me?

Ok, moving on.

C data types is the kind of data that you use for a variable. Variable here is a name for a thing. To make this thing not-quite-wide in terms of ‘what is this’, we use data types to converge this wideness.

There is basic data types, and advanced data types.

Basic data types

  • char

char is basically a character. That’s it. One single character.

  • int

int is short for integer. int is VERY WIDELY used for data types, due to its very simple name and people is very lazy to do other variable as a number. Yeah, this is widely used for number, what do you expect from an integer? int can hold from -2^32 ~ 2^32-1 , any number around that, is okay. More or less than that, is not okay.

  • short

Basically an integer but shorter. As the name says. short is just useless unless you have a fucking DOS computer with vibrating floppy disk and 1 GHz processor.

  • long

Oh you need a number more than 2^32? Don’t worry, we have ‘long’ here. long is used when int doesn’t satisfy you. long is a long version of int.

  • long long

OH YOU STILL NEED BIGGER NUMBER THAN LONG HAS? Well, I introduce you, ‘long long’, the tall old cousin that holds very fucking huge-ass number, from −9,223,372,036,854,775,807 to +9,223,372,036,854,775,807. COUGH COUGH sorry I have an allergic to indistinguishable numbers.

  • float

What would you do if you want to make a number that is not round? I mean, say you want a 2.5. How the hell do you do that? Introducing, float, now without coca-cola, ice cream on top, ice, cup, basically not a drink. float is used when you need

  • double

Jumbo float.

Every number data type you just read, can be modified with special word.

Unsigned.

Unsigned <the number data types> is basically the same size with yout normal number data types, BUTT take every possible number on the negative side, move it in front of the maximum number, so you now have DOUBLE (2x) the normal data type. For example:

unsigned long long oohohohohohoho this is so huge like my.. nvm

Normal long long: −9,223,372,036,854,775,807 to +9,223,372,036,854,775,807

Unsigned long long: 0 to +18,446,744,073,709,551,614. WOOOOOW

Now that’s it for now. Don’t wait for me to post another thing again. I have an exam 😦

Advertisements

Learning C Programming – Intro with Code::Blocks

Really? You ask me how to program with C? lol you must be joking.

But on a serious note, I can do some C stuffs, and I can teach you the basic of C programming.

So what the heck is programming?

Programming is something that you do to make a program that solves… things.

No, really, in this kind of method (my method, lol), you only C programming (hehe) as something that do some counting shit. The more advance using of programming, idk how that’s my job to learn it in the future.

Okay then, programming is making a program, so how do you start?

The most basic program you can use is C. And C and its derivative are the fundamental thing on programming. But with my way, we will use it for solving numbers… stuff.

The first thing you need to do is install the IDE.

“THE HECK IS IDE” Well, IDE stands for Integrated Development Environment, which is basically something that helps you to program, from writing, checking, executing, and more. The IDE you can use for my tutorial is DevC++ or Code::Blocks. I personally use Code::Blocks because there is an autocomplete feature that helps you when you’re too lazy to write. I am lazy too don’t worry.

CODEBLOCKS LINK (use the binary release)

For DevC++ idk too much lol I am gonna teach you only from codeblocks. But don’t worry programming with DevC++ is pretty much the same if you ask me.

cbui
So this is how it looks like after you install Code:Blocks. Pretty, right?

First thing first, look at the top right.

topleft
Top Left

See that picture of page with plus? yea that means ‘New’, I am gonna slap you if you didn’t get this. The right of it is load, one more right is save. Didn’t you understand Microsoft Word?

clicktopleft
You click the ‘New’ button

Click that page thing button. After that you see this menu. Click on the project. Don’t worry, I also didn’t know why the other thing is there also. Why project, you may ask. Because if it is not project, you can’t check it, you can’t debug it, and you can’t compile it. THERE IS NOT EVEN AN AUTOCOMPLETE 😦 so yeah I suggest you to do this.

menu
Boom. Some shit comes out.

WTF is this, Wraith?? This is uhhhhhhh menu that choose what kind of application you want to make. For this tutorial, Just click Console Application, and you’re good to ‘go’. (See the top right of the picture)

C
Choose C. We’re not learning C++ for now, alright? My college is a mess and I can’t teach you C++ right now.
C
Choose where will you put your program. Name it.

TO BE NOTED, DO NOT use Space character on your program’s name. There is something not good behind it so for your own sake don’t do it.

Then press next, and then next blah blah blah. You’re done! Wait a bit.

proje.png
Notice something on the left side. The arrow’s point. Yeah, the projects.

The Windows icon- I mean, the CodeBlocks icon, if the word beside it is BOLD, it means that that project is an active project, that you will build, run and bla bla bla.

Click sources twice, then click on the main.c twice also, and then…

Code
HOLY SHIT YOU’RE A CODER NOW

No, just kidding. You’re not a coder. That code you see is a template for any main.c file for a new project.

Now press F9.

exec.png
WTF YOU ARE REALLY A HACKER NOW

F9 basically a shortcut for ‘Build & Run’. Or I would say, ‘TEST MY PROGRAM NOW’.

Or if you want some conventional clicking, below the dropdown menu, there is a button with GEARS and PLAY icon, beside the blue recycle icon. That’s the button for build and run. Go explore other things inside codeblocks, maybe you’ll find something useful.

just go i am your dad

So that’s all the basic thing for introduction for C programming. Next up we CODE, real CODE. cya