DEV Community

Jagadeesh Koyya
Jagadeesh Koyya

Posted on

Hello World!

Hey there!
We all know what's a "Hello World" meant in a programming language. It's the begining of a very exciting journey. Whatever language you take, it's the basic block.

Likewise, I'll tell you something. Something which can strengthen your core in C programming.

What do you need when you learn a language? To be specific, a human language. (Like English!) You're gonna need to learn the 26 alphabets at first. Then you can form some words then sentences and paragraphs!

It happens with the "C" too. You're gonna need to have an idea about...

  • Alphabets (Upper & lower case)
  • Digits (0-9)
  • Special Symbols(€¥$¢@₹$)

Then let's create some words. Those are called as:

  • Constants
  • Variables
  • Keywords

A constant (literal) is an entity, whose value can't be changed. Where as a variable (identifier) is an entity, whose value can be changed.

There are 32 keywords in C like "struct, int, float, char, etc..." A keyword carries a special meaning. You can't use a keyword as a variable.

We, humans do store memory in brain cells as same as C language stores memory in bits/bytes in contiguous memory spaces. For this memory, we define it with a variable name. So that we could access it whenever we want.

Ex: int x = 19;
float f = 33.33;
char c = 'a';

See, constants here are 19, 33.33 and 'a'. Constants are of two types to be precise.

  1. Primary Constants (Integer, Real, Characters)
  2. Secondary Constants (Arrays, Struct, etc we can discuss them later).

Ex: Integers are like -1,0,1 ranging from -32768 to 32767 which is dependent on the architecture and compiler of your platform.

Real constants are again classified as fractions (or decimals like 13.45, 6.666666) and exponents with a mantessa and exponent seperated by 'e' (say 3e-5, -8E-2).

Character constants take 1 byte only as in 1 character (we can later discuss on strings, which can store multiple characters).

Where are we at? Oh, I see. Coming back to the variables. Identifier rules:

  • Begin with a character or an underscore
  • Includes alpha-numeric characters
  • Don't keep any special characters rather than "_"

Ex: kj25, k_j, c_programming_is_easy

So what'd you do after building words in english? You go for sentences. There we go! Sentences are nothing but "instructions" in C.

Every instruction is a statement in multiple lines of a c program. A instruction is nothing but an operation or commands to get our desired output.

Instructions are of 3 types:

  1. Type Declaration Instruction
  2. Arithmetic Instruction
  3. Control Instruction

Type Declaration instructions are nothing but the variables at the time of the declaration with their respective data types. For example, an integer storing variable should be declared with "int" data type.

Ex: int a = 39; but not int a = 33.33;

Arithmetic Instruction are the operations performed using an assignment operator (=) and arithmetic operators (+,-,/,%,*).

Ex: a = a + b;

Control Instructions are the coolest ones, because we can write programs to decide which statement gets to be executed first or how many times a block of statements can be executed. Isn't it exciting to take control of your own program? Yeah, I feel you!

Save your energy for the next update, until then guess the output of this program.

int main(){
printf("Hello World");
return 0;
}

Top comments (0)