Golang is similar to c language. The Go language is described as a "C-like language", or "the C language of the 21st century", and its syntax is similar to C; Go inherits similar expression syntax, control flow structure, basic data types, and call parameter transfer from the C language. There are many ideas such as values and pointers, as well as the running efficiency of compiled machine code and the seamless adaptation to existing operating systems that C language has always valued.
The operating environment of this tutorial: Windows 7 system, GO version 1.18, Dell G3 computer.
golang is similar to the c language
Go (also known as Golang) is a language developed by Google's Robert Griesemer, Rob Pike and Ken Thompson Static strongly typed, compiled language.
The Go language has been described as a "C-like language", or "the C language of the 21st century". Go inherits similar expression syntax, control flow structure, basic data types, call parameter value transfer, pointers and many other ideas from C language. It also has the running efficiency of compiled machine code that C language has always valued and is consistent with existing Seamless adaptation to the operating system.
Go language syntax is similar to C, and its functions include: memory safety, GC (garbage collection), structural form and CSP-style concurrent computing.
Go supports garbage collection. Go's parallel model is based on Tony Hall's Communicating Sequential Process (CSP). Other languages that adopt a similar model include Occam and Limbo, but it also has features of Pi operations, such as channel transmission. Plugin support is opened in version 1.8, which means that some functions can now be dynamically loaded from Go.
Go language is the C language in the cloud computing era. The Go language was born to allow programmers to have higher productivity. The Go language is specially optimized for the programming of multi-processor system applications. Programs compiled using Go can be comparable to the speed of C or C code, and are more secure and Supports parallel processes.
When developers choose a language for their projects, they have to choose between rapid development and performance. Languages like C and C offer fast execution speed, while languages like Ruby and Python excel at rapid development. Go language builds a bridge between the two, not only providing a high-performance language, but also making development faster.
Comparison between golang and c language
1. Comparison of code management
In C language, code is managed through files
When you want to use a certain function, you only need to include the corresponding .h file
Code is managed through packages in Go language
Go language does not have the concept of .h files. When you want to use a certain function in Go, you only need to import the corresponding package
Public and private management of functions and variables in C language
Whether functions and variables are exposed through extern and static
Public and private management of functions and variables in Go language
Use the first letter of the function name to realize whether to expose the function
Use the variable name Is the first letter case to implement public variables?
2. Keyword comparison
There are a total of 32 keywords in C language
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
##if | else | switch | case | default | break | return | ##goto | ##do|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for | continue | typedef | struct | enum | union##char | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
int | long | float | double | void | sizeof | signed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const | autoregister | static | extern | volatile |
There are a total of 25 keywords in the Go language
Go language data type
Each data type in C language occupies memory space Type 32-bit compiler
32-bit compiler
In addition to the following standard formats, Go language also provides several simple syntax sugar 、 】 |
The above is the detailed content of What is golang similar to?. For more information, please follow other related articles on the PHP Chinese website!