what can i do with c?

hi , well im alittle bit confused ..no im alot confused ... there lots of programming languages out there and i dont know which to study ..!!!
i have a primary information about C and C++ language ...
i ve heard , c is one of the most powerful languages in the world and you can do anything and write anything using this language ...
but what ? what kind of thing im going to be able to write by knowing C?
all i ve seen is the programmes that are written in C and for Dos of course .
i really wana know it .. how to find my way out among all of these languages
please help me and tell me alittel about c and programming ... im so sorry if i post this on a wrong session ...

thanks alot
[724 byte] By [Master.] at [2007-11-20 10:50:40]
# 1 Re: what can i do with c?
Hi,

C is somewhat outdated and has been superseded by C++. Yes, C++ is probably the most powerful and flexible programming language and de-facto standard for professional programmers. Theres little you cant do with C++ but theres always the choice of the right tool for a certain task. LISP/Scheme may be a better choice when developing some AI, Fortran may be better for mathematical problems and COBOL may be the language of your choice when dealing with commercial problems. But, of course, you can do that in C++, too.
Almost every program youre using is written in C/C++, the latest ones maybe in C# (which is more like Java than C++). Provided you have the knowledge and experience you can write literally any program in C++.
GNiewerth at 2007-11-9 1:24:39 >
# 2 Re: what can i do with c?
Hi all.
First, let talk about the differences between C and C++. C is a programming structured language designed in 1970, C++ is an its evolution, that adds some concepts about object oriented programming. The relatinships between the two language is very strict, so C is considered an subset of C++.
If you use C you'll develop with the (old) programming structured principles, while if you use C++ you'll develop with the (new) Object Oriented principles. Yes, C is very powerful but the problem is when using it: in my opinion C is more efficient than C++, but C++ is more "advanced" than C, so one should use C when performances are critical (for example real time application).
davide++ at 2007-11-9 1:25:36 >
# 3 Re: what can i do with c?
But what you can often find when somebody has chosen C for ulimate speed is that they end up reverse engineering some of the C++ concepts anyway. I know I did, and that was before I even knew anything about C++.
JohnW@Wessex at 2007-11-9 1:26:42 >
# 4 Re: what can i do with c?
It depends what you want to do. If you are going to be coding something that is going to be processor intensive, then you will most likely want to program it in C/C++ because you will get the fastest runtime performance. But if you want to say program a nice GUI app and you are not going to be hitting the processor heavily in the underlying functionality, then you might want to try using a higher level scripting language. The reason for this is to get the same functionality that you would get from a handful of lines from a scripting language(e.g. tk/Python), you would end up writing thousands of lines in standard C++. Visual C++ helps bridge this gap, but it is not very portable. It's important to choose the correct language for the task.
PredicateNormative at 2007-11-9 1:27:47 >
# 5 Re: what can i do with c?
C is not "outdated" it is very popular still for device-driver programming. The latest C standard is C99 which has some features not available in C++.

They created an "embedded" standard for C++ too which had a subset of the language, i.e. no templates and no exceptions.

Where I still use "C" is to providing what I call "C interfaces" for libraries as a C interface is far more portable. I then provide an "open-source" C++ wrapper. The C++ wrapper is intended to be fully compiled into your own code, not linked in as a library. For C++, for those will load the library dynamically (dlopen / LoadLibrary) you can provide also a special class which has all the functions they will need to call, and all of them virtual. They will then call dlsym just once to get a pointer to this class, rather than having to call dlsym for each function they intend to call. The library itself can have a static instance of this class and all the members can be const.

C interfaces provide better portability (no name mangling, better integration with other languages).

It is a myth however that C produces either faster code or smaller binaries.
NMTop40 at 2007-11-9 1:28:39 >
# 6 Re: what can i do with c?
It is a myth however that C produces either faster code or smaller binaries.

The speed part I will agree with you, it is a myth. It is NOT a myth that it produces smaller binaries. The lack of mangled names in *.obj files that the linker links together to become an executable, ensures a smaller output file. Import and Export tables. That and runtime checks in C++.

It's not a myth that C equivalent code is smaller than the C++ equivalent. I know, I have implemented 'classes' in C with manual VTable creation, it ends up a smaller *.dll for sure.

typedef struct _MYCLASS_VTABLE
{
void * Reserved; // TypeData reserved member
void (__stdcall * Destructor)(void * lpObject);
void (__stdcall * SetValue)(void * lpObject,int Value);
int (__stdcall * GetValue)(void * lpObject);
} MYCLASS_VTABLE;

typedef struct _MYCLASS
{
const MYCLASS_VTABLE * pvTable;
// Data Members
int Value;
} MYCLASS;

#define VirtualCall(obj,Function) (obj->pvTable->*Function)

void __stdcall MyClassDestructor(MYCLASS * pObject)
{
}

void __stdcall MyClassSetValue(MYCLASS * pObject,int value)
{
pObject->Value = value;
}

int __stdcall MyClassGetValue(MYCLASS * pObject)
{
return pObject->Value;
}

static const MYCLASS_VTABLE_DATA = { 0, MyClassDestructor, MyClassSetValue, MyClassGetValue };

MYCLASS * CreateObject()
{
MYCLASS * pClass = (MYCLASS *)malloc(sizeof(MYCLASS));

pClass->pvTable = &MYCLASS_VTABLE_DATA; // assign the vtable data
pClass->Value = 100; // give it a default value

return pClass;
}

void DestroyObject(MYCLASS * pObject)
{
VirtualCall(pObject,Destructor)(pObject);

free(pObject);
}
JamesSchumacher at 2007-11-9 1:29:44 >