In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the difference between c and javascript". In daily operation, I believe that many people have doubts about the difference between c and javascript. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "what is the difference between c and javascript?" Next, please follow the editor to study!
Differences: 1, C language needs to manage memory manually, while JavaScript memory is managed by interpreter; 2, C language is statically typed language, while JavaScript is dynamically typed language; 3, there are closures in JS, but not in C language; 4, C language is compiled language, and JavaScript is interpretive language.
The operating environment of this tutorial: windows7 system, javascript1.8.5&&c99 version, Dell G3 computer.
The difference between C language and JavaScript
1. C language requires programmers to manage memory manually (mainly refers to the application and release of heap memory), while JavaScript memory is managed by the interpreter.
2. C language is a statically typed language, that is, the data type of each variable has been determined before the program runs and cannot be changed at run time, while JavaScript is a dynamically typed language, and the data type of variables can still be changed at run time.
3. There is no concept of closure in C language. Functions in JavaScript form closures with variables that can be accessed when they are defined.
4. C language can implement multithreading by calling system API, and multithreading can be used to improve the utilization of CPU during blocking operations (mainly IO), while JavaScript is mainly single-threaded. All possible blocking operations of JavaScript are accomplished by asynchronous API provided by JavaScript runtime.
5. C is a compiled language, while JavaScript is an interpretive language. C language is mainly compiled into machine language, while JavaScript is mainly interpreted and executed by the interpreter as a script.
From the perspective of static type or dynamic type
Static type, you can know the type of each variable when compiling, and you also need to give a given type when programming, such as integer int in Java, floating-point float and so on. C, C++ and Java are all statically typed languages.
Dynamic type, the type of each variable is known only at run time, and there is no need to display the specified type when programming, such as var in JavaScript and $in PHP. JavaScript, Ruby and Python are all dynamically typed languages.
Static type or dynamic type has a great impact on the performance of the language.
For static types, the advantages of known types will be taken advantage of after compilation, such as the int type, which takes up 4 bytes, and the compiled code can access variables with the method of memory address plus offset, and the algorithm assembly of address plus offset is easy to implement.
For dynamic types, they are saved as strings, and then the access is matched by strings.
From the point of view of compilation or interpretation
Compiled languages, such as C # and Cellular languages, need to be compiled into local executable programs before they can be run, which are manually implemented by developers after writing them. Users only use the compiled native code, which is executed by the system loader and directly executed by the CPU of the operating system, without the need for additional virtual machines.
Source code = "abstract syntax tree =" intermediate representation = "native code
Interpretive languages, such as JavaScript and Python, give the code to the user directly after the development language is written, and the user uses a script interpreter to interpret and execute the script file. For scripting languages, there is no developer compilation process and, of course, not absolutely.
Source code = "Abstract Syntax Tree =" interpreter interpretation execution.
At this point, the study of "what is the difference between c and javascript" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.