Skip to main content

C Programming - 3. Bits & Bytes

Bits

Bits means the measurement of computer memory where we can store binary number or word. N-bits memory can store n-bits binary number or words

for example :

         1-bit memory can store either  1 or 0

because 1 and 0 are 1-bit binary numbers

         2-bit memory can store:
                                                  00
                                                  01
                                                  10
                                                  11


        3-bit memory can store:
                                                 000
                                                 001
                                                 010
                                                 011
                                                 100
                                                 101
                                                 110
                                                 111

and so on


Byte

1-byte memory consists of 8-bits that mean 1-byte memory can store, 8-bit binary number.

The byte is likely the unit to the measurement of computer memory.

So, it will be better if you know some relations

                                  8-bit = 1 byte
                                  1024 byte = 1 Kilobyte(KB)
                                  1024 KB = 1 Megabyte(MB)
                                  1024 MB = 1 Gigabyte(GB)
                                  1024 GB = 1 Terabyte(TB)



Happy Coding
See you in the next tutorial



Next Post:


https://coderavens.blogspot.com/2018/05/c-programming-41-first-c-program.html

Comments

Popular posts from this blog

C Programming - 4.5 The printf() function

We have been talking about this guy for so long and he finally came And you will see him most of the time whenever you write a C code. So, What printf() function do? It basically prints everything within the double quotation . for example: printf("I am a programmer"); this prints:                     I am a Programmer In full code that will be- #include <stdio.h> int main() {      printf("I am a Programmer");      return 0; } Now, see another code  #include <stdio.h> int main() {      printf("I am a Programmer");      printf("I am a Programmer");      return 0; } the output will be:          I am a ProgrammerI am a Programmer The output is like this because we haven't use newline character to indicate the en...

C Programming - 4.2 The main() function

The main() function is the entry 🔑 point of a C program Now look at the code what I wrote #include <stdio.h> int main() {      printf("I am a Programmer\n");      return 0; } OK, I wrote, int main() here "int" represents the Integer number is, an Integer number is a whole number not a fraction one like 1,2,0,10,55 etc. now, the question ❓ is- Why I wrote int main() We all know mathematical function right. for example :                         f(x) = bx+c this function  f(x)  has a return value, let's say it's Integer , then for C it is int C functions are quite similar to mathematical functions , the basic format of a C function is return_type function_name() { } by writing int main(), we indicate that this main() function will return an int number. that's ...