what is c programing language

can any one tell me in brief
It is a programming language named C.:)
It's the warm glow of a sunrise, filtering through misty clouds. It's the taste of fresh steaming tea, with milk and honeysuckle. It's the music of songbirds in spring.
C++ and C# both originate from C (and even Java originates from C/C++, essentially making C the best language ever).

To put it simply C is just another language in which to pass instructions to the computer, unlike many languages C introduced typenames for specifying how variables should be read, stored and manipulated giving it a great deal of extra uses. C includes functions which where available in languages before C but now they have return types and arguments so functions can be used with assignments for variables or to do something specific with different calls with what is passed to the function.

C programs made up of a starting function (main, WinMain or equivalent) for every application and a list of instructions, known as statements. Even the most complex of applications simply usually just spend most of there time adding numbers together and comparing them against each other, plus a few external function calls which will do things with these numbers such as draw images.
Last edited on
Googling "what is C" would have led you here:

C (programming language)
http://en.wikipedia.org/wiki/C_%28programming_language%29

In computing, C (/ˈsiː/, as in the letter C) is a general-purpose programming language initially developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Labs. ...

Or, if you prefer...

http://lmgtfy.com/?q=what+is+c

Andy
@SatsumaBenji
and Java originates from C#,


When Java appeared there was no such language as C#. It is C# that originates from Java. It is a Microsoft answer to Java.:)
Java originates from C#

Erm, nope.

C# appeared in 2000
Java appeared in 1995

The syntax of Java was largely derived from C++ (it's got classes sort of like C++). I believe this was a deliberate ploy to make it easier for people who already knew C++ (or C) to learn Java, as they would already be comfortable with that kind of syntax.

making C the best language ever

Bast at what?

I'm not a Java fanboy, but Java is better than C (or C++) for RAD.

Andy
Last edited on
C# appeared in 2000
Java appeared in 1995


Well... Whoopsy
But Java did originate from C/C++ and was developed for cross platform interpretation programming. Still, C's better :D

Because C/C++ compiles strait to machine code it's fast, and because it's developed by the leading operating company it's also very powerful.
Granted Java does have the benefit of being cross platform for the fact it's interpreted but this also makes it much slower. I do think that internally Java's interpreter uses pointers to keep variable passing quick but I'm not quite sure, I do know that there's no pointers when writing Java script though.
Last edited on
@SatsumaBenji
But Java did originate from C/C++ and was developed for cross platform interpretation programming. Still, C's better :D


Java did originate from C++ not C. And I did not see any argument that C is better then Java. Only bla...bla..bla...
Java cannot store variable addresses (pointers) so it's not ideal for many heavy duty programs that pass around large pieces of information because it'll have to pass everything by value. And as I did say before Java is an interpreter language which makes it much slower because its constantly having to translate from java into machine code, where as C/C++ is compiled into machine code so it can be read directly which is much quicker.

I am not saying that Java is completely useless because for small things its a brilliant idea, creating an app once and running it on all systems... But if you know how to rewrite the app in C for different systems it'll be Much quicker, and likely to be able to include a lot more features.
Totally wrong statements!
Your pointers are need nobody. Your "heavy duty programs" are in the best case 5% of all programs.
The development of a C program that is analogous to a Java program take in times more time and less effective.
C is better only in one case when you need to write a console application.
closed account (N85iE3v7)
Most embedded applications are written in C, as before they were written in assembly. I am not mentioning Android apps, I am just mentioning real hardcore embedded systems which are the most numerous applications. Although ARM processors have optimization to allow Java Virtual Machines to be run within their core, still you will have to code the firmware, low level in C.

Operational systems are mostly written in C or C++. Real time software will be less efficient if written in Java, because you always need Java wrappers over C DLL/libraries. I read that - so I cannot confirm it - that recently Java has improved somehow its conversion to native code on run time, but I really don't know.

I could tell you that Qt or C++ Builder are far easy to use frameworks to use for GUIs. Qt, is a multiplatform framework that allows very easy conversion from/to Windows/Unix/Linux. MFC/Visual C++ has a bigger learning curve, still, you can use it to write simple and fast applications without requiring Java. But the Swing API is a quite decent and easy to use GUI library.

C# is a good language for the windows OS, I rather prefer it to Java. Please read that I said "I prefer". As a C/C++ programmer I easily can switch to C# mode while with Java it is a bit of a pain.

The only times I was blown away by the power of Java was when I used cell phones that have built-in Java Virtual Machines and of course, the whole Android thing is fine.

As for web, I cannot tell you much, I dabbled a little bit with Servlets and JSP and thought they were GOOD, but I am not a web programmer.

I find it hard to say that languages are better than others, it all depends of your goal and what's paying your salary.

Edit: Objects are passed by reference in Java by the way. One can allocate a real huge object that is every time passed as a reference.
Last edited on
@zlogdan
Operational systems are mostly written in C or C++.


It looks like that you do not understand what you are writing.
For each operational system that can be counted using your fingers there are at least thousands of applications that do not need C in totally.
closed account (N85iE3v7)
@vlad

- Unix, Linux, Windows Mac OS are written in C/C++. Without them none of these small apps would be possible or necessary. In fact, If I were to write simple console apps I would write them using a native shell script language.

- RTOS are re bundled in so many embedded systems that I could not quantify.

- The Java Virtual Machine is written in C.

- Device drivers, low level APIs, real time applications, web servers, all these benefit tremendously of the fact they are written in C. In fact you could not write any of them in Java.

I am not really advocating you to write C++ code rather than Java, I am just saying that while it is widely said that C++ is harder to learn than Java for programming novices, once one is fluent in both it really does not matter.

If in the future, if I have to earn my living with Java, I would not really mind.
Last edited on
@SpaceWorm


It would be better if you would update a bug in your SafeSend function in thread http://www.cplusplus.com/forum/windows/102647/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
int SafeSend(SOCKET s, char* buf, int buflen)
{
	int sendlen = 0;
	int totalsend = 0;
	int remaining = buflen;

	while(sendlen != buflen)
	{
		sendlen = send(s, &buf[totalsend], remaining, 0);

		if(sendlen == SOCKET_ERROR)
		{
			return SOCKET_ERROR;
		}

		totalsend = totalsend + sendlen;
		remaining = sendlen - totalsend;
	}
return 0;
}


Insetad of

remaining = sendlen - totalsend;

I think there should be

remaining = buflen - totalsend;

By the way this example with the code demonstrates that in most cases it is better to use Java than assembler-like C.:)
Last edited on
closed account (N85iE3v7)
troll.
@vlad from moscow
Totally wrong statements!
Your pointers are need nobody. Your "heavy duty programs" are in the best case 5% of all programs.
C is better only in one case when you need to write a console application.


Really?
Have you thought that this 5% case is because it can't be done in Java so people don't do it?! Now take a look at the "heavy duty programs" in C/C++ which are everywhere!

How about game programming for example? You pick any 50 pc games from the top of your head and count how many are written in C/C++ compared to Java?

How about any kind of media editing? Pick 10 or 20 video/image/music editors... See how many of them are written in C/C++ compared to Java?

How about even the simple, LESS heavy duty things such as messenger programs, i.e. the Skype/MSN/AOL clients... How many of those are written in C/C++ compared to Java.

The only thing I DO KNOW that are written in Java that come anywhere close to this is Minecraft, which is most unquestionably the lag-iest, most bug riddled game on the planet, and Android apps which are LOW POWER... And actually saying that, not an awful lot of apps on Android run well with a processor less than 2ghz, and It's a phone! Why should you need PC sized processors to use a phone?


I think my point is therefore proven, as I did say before it came to this, I do think Java was a good IDEA and does have its uses here and there for small scale things but you all kept arguing so there you go!
Last edited on
It looks like that you know nothing except games.:)
C is used the most part because there is old C code-base. For example I could append your post mentioning that the IBM NFS server and client are writtten in C. But opposite to you I know very well the reason why they are written in C. The reason is very simple. The qualification level of the IBM team that are writing the code is so low that till now they use goto statements and think that they can assign values to string literals.:) So they simply unable to rewrite the code in C++. Till now they do not understand what is the OOP. And when I rewrote the CTRACE record filtering program in PL/X using its OOP features they were very suprised.:) Because even in this simple language as PL/X they did not use its OOP features.
As for C++ then development of C++ projects is very expensive and requires programmers with a high qualification. I do not even mention that C++ compilers are not compatible with each other.
Topic archived. No new replies allowed.