তথ্যপ্রযুক্তি

The ABCs of C Programming

Share
Share

Except for a handful of boys and girls in our country, most of us encounter the term “programming” only after coming to university. Nowadays, though, the subject is getting some focus starting from the college level. This post is written mainly for those who are new to programming. I am quite a beginner in programming myself. My aim is to help those who are just starting out with programming. I don’t know how much—or if at all—I’ll be able to help. The books you find in the market are written by experts, which can be a bit hard for newbies to understand (at least that’s the case for me). That’s why I’ll try to explain things in a simpler way.

I think choosing C as your first step in programming is a good idea. This is because, comparatively, you can get started by learning very few keywords and functions and you don’t need to know too many programming terms. Anyway, I personally believe in learning by doing. So when a new term comes up, I’ll explain it then. I won’t suddenly bring in lots of new terms out of the blue—that just creates confusion and discouragement.

I’ve already mentioned two things: keywords and functions. Let me explain those first.

Keyword: Simply put, a keyword in C is its inherited property. We use these during programming to inform the compiler about the data we will use and what type it is.

Function: Think of a function as a kind of converter. A function takes the input that we provide and converts it depending on the nature of the function.

Compiler: The compiler is a very vital thing. It makes our written code understandable to the machine by converting it into binary. Modern compilers do much more—they also try to tell us if there are any errors in the code and, if possible, point out exactly where the mistake is. I said “try” because it can’t always do this. But if the compiler claims a certain line has an error, it’s almost always because of a mistake by the programmer, and usually, the error will be somewhere near that line. Besides that, the compiler also does code prediction.

To make programming easier, we can use various compilers, like DevC++ or Codeblocks. If you don’t know how to use them, just check out tutorials.

Let’s jump straight to the basic structure of C:

#include
main()
{
printf(“Hello World!!!”);
}

The program I’ve written here is probably the most commonly written program in the world. It contains the main elements of C programming and should give you a basic idea.

First, I’ve written “#include”.
Here, I’m telling the compiler to include the header file named stdio.h (stdio = Standard Input Output) in our program. Simply put, header files have a .h extension and provide us with some ready-made functions.

Next, I wrote main(). main() is a function that appears in every C program. All programming tasks happen inside it.

Then there’s an opening curly bracket, which signals the start of a code block. A code block is valid code inside the opening and closing curly brackets.

Next is printf(“Hello World!!!”);. Here, we’re telling the compiler to display the line “Hello World!!!” on our monitor. printf() is a built-in function, already compiled in stdio.h. There’s more to know about printf(), but I’ll get to that later. The semicolon ends a line—in other words, it marks the end of a command.

Finally, the closing curly bracket ends the program. If you compile and run it, you’ll get an output just like the one shown in the picture.

If you’re using Turbo C, be sure to write:

#include
main()
{
clrscrn();
printf(“Hello World!!!”);
getch();
}

clrscrn() (clrscrn = clear screen) clears previous outputs, and getch() (getch = get character) keeps the program running until it receives the next input.

That’s all for today. The next post is coming soon.

Share
Written by
Faysal Ishtiaq Rabby

আমি প্রোগ্রামিং নিয়ে আগ্রহী । কিন্তু কিছুই জানি না । খুব ভালো বুঝি এমনটাও না । প্রোগ্রামিং জিনিসটা শুরু করতে গিয়ে কিছু প্রবলেম এর সম্মুখীন হচ্ছি । যারা প্রোগ্রামিং জানেন, তারা আসলে অনেক ব্যাস্ত থাকেন । তাই, নতুনরা অনেক সিম্পল জিনিস নিয়ে ও হিমসিম খায় । আমি চেষ্টা করব তাদের কিছুটা সাহায্য করার ।

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

ফ্রি ইমেইল নিউজলেটারে সাবক্রাইব করে নিন। আমাদের নতুন লেখাগুলি পৌছে যাবে আপনার ইমেইল বক্সে।

বিভাগসমুহ

বিজ্ঞানী অর্গ দেশ বিদেশের বিজ্ঞানীদের সাক্ষাৎকারের মাধ্যমে তাদের জীবন ও গবেষণার গল্পগুলি নবীন প্রজন্মের কাছে পৌছে দিচ্ছে।

Contact:

biggani.org@জিমেইল.com

সম্পাদক: মোঃ মঞ্জুরুল ইসলাম

Biggani.org connects young audiences with researchers' stories and insights, cultivating a deep interest in scientific exploration.

নিয়মিত আপডেট পেতে আমাদের ইমেইল নিউজলেটার, টেলিগ্রাম, টুইটার X, WhatsApp এবং ফেসবুক -এ সাবস্ক্রাইব করে নিন।

Copyright 2024 biggani.org