+ 50
How is C different?
https://code.sololearn.com/cMdIBP97t15d/?ref=app https://code.sololearn.com/cf48wVEUVAjs/?ref=app https://code.sololearn.com/c0hUNpD8Ez0b/?ref=app https://code.sololearn.com/cZk1NL4iD5Jt/?ref=app https://code.sololearn.com/cNEYqWKIVpjy/?ref=app https://code.sololearn.com/cno6MPOOWqxH/?ref=app https://code.sololearn.com/cGm2MPUH9VFC/?ref=app https://code.sololearn.com/cmI6c3OZQ86h/?ref=app As you see, the C is faster 2 times... all language performs the same... is this because of solo learn interprete the language ? but why C is different? edit: Some other fact i got, when i check the time used, it took 0.0 second with such loops :v
20 Answers
+ 27
2 times slower? I can see that it is exact 2x slower
+ 26
C language was primarily being developed for the Operating systems and supporting unix OS. This is the most powerful language for the time, however people like new things, but still its speed is absolute cracker.
+ 21
C was written directly from assembly language. Other languages like python are interpreted languages, therefore the virtual machine increases execution time.
+ 20
C and C++ are faster than the other language when it runs as a compiled program... here, in sololearn, they can seems to be slower because i think they are not previosly compiled...
+ 14
unfortunatly, python’s slow execution time is a huge drawback for the language
+ 13
Amanullah
But, as we see, just try changing the number. You'll see that the other will reach "Time limit exceeded" on 10¹², but on C is 10¹³
+ 12
In my Opinion Why We Did not use C because
1) C is very old and Peple like New things
2) i like python so i explan python Vs C
Python has object oriented capabilities which C doesn't. So larger projects, Python will probably win. But again for larger projects that need keeping the code hidden from end user I don't think Python wins anymore. Note: Python bytecodes can be used to kind-of hide your source but as I've read, they can be decrypted too.
+ 10
c is known as middle level language because it supports alp (will explain later below) and can do wonders like high level language to some extent.
because of C's flexibility with ALP and some great inbuilt library functions C can directly interact with operating system! .....also cpp is considered higher level but for os level programming c is choosen .
if you are planning to learn c ....dont leave it after basics ....learn it till you get to know OS level programming.....
also i should mention that i m also at learning stage bt m done with basics.......soon i will be going for advanced level .
lastly all the best 😇
+ 9
Just correcting, C is written in C but it compiles to machine code directly (Assembly and binary). C is faster because the compiled files' instructions are read by the CPU directly (edit: interacting with the operating system depending on the hardware it is running on).
Some languages can be as fast as C (e.g. C++) if they don't include much runtime intermediate code, and if they ultimately compile to Assembly/binary.
The main reason for languages like java to compile your code into an intermediate representation of it is because of cross platform development. You should search for these issues and discover for yourself how they impair cross platform native code programming.
+ 8
C# execution time is the slowest among the rests.
I think it happens because you include more than one "using directive " to perform the loop.
+ 7
Subaash Pon I don't think that's what ShortCode was asking
+ 7
I think we should be cautelous while saying that C code are read directly by CPU. By these words we kill some OS functions.
C code, in resume, is faster because of its level. It's not as low as Assembly, but it's lower than Java, for example. So the "modules" (headers, etc, generalizing as modules) necessaries end up being more specific, loading less things, requiring less time...
You can also speed up languages like Java, specializing the use of the "modules", but this would be too much effort. Totally not worth it and a lot harder, it's not what the language is made for.
You can compare C and Assembly, for example. Assembly is a lot more specific than C, so also is on modules.
+ 6
If we talk about C++ we can say that it is more secure and safe language than that of c.
In C, the most important and severe problem is of data hiding and data security, reusability of codes and many more. But C++ provide these facilities.
It is based on OOPS concept and provides Data Abstraction, Encapsulation, Inheritance.
Class concept is very much useful for data safety purposes.
Overall C++ is much better and somehow different from C.
+ 3
Its like Java and C++ know it!!
+ 3
What I can say c is based structure language mother of all languages due that till today is used though other languages each is specializes to specific function
+ 3
Also c language can divide big program into small and multiple program linked together to ensure is easy to understand compared to other languages
+ 2
Amanullah , look at the powers of 2.
C can print 2 times more characters as the other languages
+ 1
Based on the interest only it depends whether C is difficult or not . Because C is just a basic , if u learn C then upcoming hard languages may be seems to be easy for u ... Thank u
0
Benz
- 1
lol i didn't get u. for me ruby,python runs faster than c.
hmm ?