DEV Community

Frey
Frey

Posted on

Features of C :)

/*
today we will cover some features in C
as c is widely used it must have some of the major features :) like

  1. Simple c is a simple language which is because of it's structured approach and the rich libraries and Data types
  2. Machine Independent or Portable unlike assembly language c language can be performed on different machines :) and that the main reason of building C language :) 3.Mid-level programming language as we know c is used to develop the hardware and kernel but altho it is also consider as a mid language because it is used on different machines as any high level language is used :)
  3. Structured programming language it is a spl language as we can break it into steps with the use of functions which make it easier to understand
  4. Rich Library c gives you a lot's of inbuilt functions which makes development fast.
  5. Memory Management c support the dynamic memory allocation in which we can free the memory by using free() anytime we want
  6. Speed c is fast yeah it is because of less inbuilt functions as i have texted above it have inbuilt functions which makes it a rich library languages but you can simply say that they are quite less then other High level language
  7. pointers c supports pointers well this the the coolest thing i like about c because by pointers we can use c to direct interact with memory and we can use pointers for memory, structure, arrays. well you will you will also fall for pointers if you are learning C
  8. Recursion it is noting just a function within a functions i will go with a function soon enough and cover this topic :)
  9. Extensible why it is extensible because c can able to learn new things from it's master means you can teach c new things and have more fun with codes. well this is for today Arigato :) see you on next article.

~ Frey
*/

Top comments (4)

Collapse
 
faranaiki profile image
Muhammad Faran Aiki

"Speed c is fast yeah it is because of less inbuilt functions as i have texted above it have inbuilt functions which makes it a rich library languages but you can simply say that they are quite less then other High level language," actually, built-in function can has nothing to do with the performance. What makes C fast because it is (the compiled code) interpreted with the CPU/processor itself, whereas Python or Java is interpreted by a software, and that software is interpreted by CPU/processor.

Collapse
 
sh4zkh4n profile image
Sh4zKh4n

Hey, it's because python is written in C, so when you have code in C, your going from C to machine code and it's compiled at the beginning. Python is written in C, so your going from python to c and there's something about the compilation which isn't at the beginning but dynamic. Which means with c you going back and forth in 2 levels and in python 4 levels. All of which will add on time. With say a for loop day it's going to increase the steps by *2 but because of the added time of compilation and wait compile down one level, the speed decrease is significantly more.

Collapse
 
faranaiki profile image
Muhammad Faran Aiki

No, "C to machine code" is just plain wrong. C is not interpreted. C is compiled, meaning there is no "go back and forth". If you write a programming language, let us say a compiled one, using C or using other language, and with an addition rule that the compiler can optimizes it, then the speed would be the same as C. Take a look at Rust, the language itself is using OCaml (at first, which is made using C).
Nowadays, C is compiled first to Assembly. There are some compilers that translate, assembling, C directly to machine code, TCC for example.
Python does not go to C. Who compiles Python code into C in terms of normal Python? Python use the opcode itself to optimizes itself. Take a look at the "dis" module in Python.

Thread Thread
 
sh4zkh4n profile image
Sh4zKh4n

Sorry your right if your going one way. I was thinking of the classic nested for loop.

For i in xxx
For b in xxx

Should have added that in. In my head that was the classic example. Back and forth.