In programming language discussions we hear terms such as low-level, middle-level, and high-level. How are these determined? Would C be considered a middle-level language?
Low-, high-, blah-level is all just vague terminology with no deterministic factor behind it. Traditionally, low-level languages refer to machine code and assembly, and high-level refers to everything else. More recently, we have "very high level" used for scripting languages (anything interpreted rather than compiled). I have never heard "middle" used for anything.
That said, you will hear lots of argument on whether C or C++ are low-level or high-level languages, as some people prefer to think of C/C++ as low-level now given their relative position to other languages (25 years ago this would be unheard of). It is largely meaningless unless you agree on a definition of low-level or high-level. So you could easily come up with a definition of "middle-level" and then use that to determine whether C counts as middle-level or not.
If you look at it from a function point perspective, it would be middle to low level.
Middle-level language is used because you can go really low, doing assembly, but it also contains elements or abstractions of higher-level languages
but i agree with danben..there's no deterministic factor behind it...
I found this to be the reason for such a bias between high level and low level classification.
C is often called a middle-level computer language as it is a combination of the elements of high-level languages with the functionalism of assembly language.
High Level language :
A high-level programming language is one that's more user-friendly, to some extent platform-independent, and abstract from low-level computer processor operations such as memory accesses.
Low Level Language :
A low-level programming language is a one that is more machine specific, and from computer processor operations such as memory accesses is directly dependent.
courtesy : http://www.cfanatic.com/showthread.php?s=cfa39a622e72217cce1fb9118a90fd79&t=130
My old C books from before C++ was around talk about C as a middle-level language. But that was before Java, .NET, Ruby, Python, etc were around. I'd say the (vague) boundaries have shifted somewhat as the high-level languages like Ruby/Python became so much more advanced.
C is only one step above Assembly, but above C you have C++, then Java/.net, then Ruby/Python. So I'd say C is now a lower or lower-mid level language since you can quite easily map it to asm/machine code. I'd say C++ is a mid-level language, Java/C# mid-high, Ruby/Python high.
Though the terminology is quite vague, I consider C to be a mid-to-low-level language. You have very low-level features (manual memory access, pointer arithmetics) and very few abstractions - It's almost literally converted to assembly. As Wikipedia states C++ is a typical mid-level language, since you have the low-level access of C combined with abstractions like object orientation, templates and even some functional programming.
I think C should still be classed as a high level language. Compared to assembly it really is high level.
It has loops for one which makes a huge difference rather than trying to roll your own with jump statements.
Try writing assembly on an 8 bit microcontroller and then jump to using C. You'll soon realise just how far apart they are.
Edit: Since when has there been such a thing as a mid level language anyway? Mid level compared to what?
C is often called portable assembly by people who can program in assembly. Now, ask the same group of people if C is too much or too little abstraction away from assembly and you'll see rotten fruit start to fly (well, perhaps good fruit too, depending on what's available).
The 'level' to which you refer is simply the amount of abstraction between you and a compiled heap of ones and zeros. Some may say math is nicely abstracted in C while strings are just wretched to deal with.
In essence, it really depends on what you are using C to do. I don't feel that it can be classified as a whole.
From the usage point of view, in contrast to C++, C provides less language syntax, semantics and facilities. C is a lower level language than C++.
while from function point of view, if a language can provide powerful functions under the help of remarkable infrastructure, such as Windows SDK C API, I think it really can be called a "high level" language.
Scripting languages provide another usage of programming language: interpreted rather than compiled. While its function is somewhat limited.
therefore, you need it, you use it. the better achieved, the higher level you enjoyed!
C is a high-level language in the sense that there's very little one-to-one correspondence between a line of C code and the equivalent machine code. Compared to languages like C++ or Java, C provides very few abstractions; beyond byte streams, arrays, and pointers (which, yes, are abstractions), there isn't a whole lot in the C toolkit.
It seems like languages are divided by generation.
These generations are widely considered to be (with the definitions having greater variance the higher you get):
- Machine Languages.
- Assembly languages (which is just a human readable version of Machine Languages)
- Structured languages (FORTRAN, COBOL, C, C++, C#, Java, Python, etc...)
- Languages used to build applications in a specific area (PL/SQL, R, FoxPro, etc...)
- Languages that work within specific constraints rather than algorithms. These are usually used in AI. (Prolog, etc...)
Having said all that, the fourth generation is sometimes said to include object-oriented languages.
I'll answer with another question: is C++ a high-level language?
It isn't: The language itself gives you classes, operator overloading, and templates. That's just syntactic sugar around structs, functions, and macros. As an example, Lightblue BREW is a zero-overhead bridge between BREW (object-oriented C) and C++ because BREW happens to be binary-compatible with C++!
Cfront was the original "compiler" for C++: it preprocessed it into C. The original compilers for Objective-C was also just preprocessors.
It is: You can write code which uses "high-level" features (memory management, garbage collection, lambda expressions, ...) without worrying about "low level" details (forgetting to free). There are plenty of C++ libraries out there (e.g. Boost).
It's far more useful to classify a language by the features it has instead of giving it a high-level-ness number. Take, for example, unpacking a .bmp ("DIB") header:
- C: Easy. Just use a struct. You might have to worry about endianness, packing, and portability to odd architectures.
- C++: Use a struct. If you're clever, the structs can also handle endianness and packing in a mostly portable way.
- Java: You have to calculate offsets into the header. If it's a byte array, you have to do masking and bitshifting yourself. (If it's a nio buffer, you just set the endianness.)
- REALbasic: It's a MemoryBlock. You have to calculate offsets into the header yourself. You might have to worry about endianness, depending on whether you use a MemoryBlock extension plugin.
- Python: Just
import struct
. None of the fields have names though, so you have to keep track of what order they're in, so it's marginally bette than calculating offsets.
There, an easy problem where C++ seems to be the highest-level language and C comes second.
I'll also note that the existence of "low level" features does not make a language low-level. In C#, you can write "unmanaged" code and use pointer arithmetic. In Python, you can import ctypes
to call C or C++ functions and import objc
to call Objective-C, losing all type-safety (I do this when I'd otherwise write a quick test program, because it's much easier than repeated compiling and running).
Besides, pointer arithmetic need not be low-level. Pointers are usually implemented as memory addresses, and C++ references are usually implemented as pointers, but there's no reason why you can't change the underlying implementation to make pointers bounds-checked, or even type-checked.
I think it is up to the user how he is using it.A high level language is that which provide abstraction and low level language is that which uses resources provided by OS(System call).In that way if a programmer is using system call to perform some task then c is a low level programming language,and if the same programmer use bash commands or other function which give view of programming then c is a high level language.So C is both high and low level programming language .