Compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. C was therefore useful for many applications that had formerly been coded in assembly language.
Despite its low-level capabilities, the language was designed to encourage machine-independent programming. A standards-compliant andportably written C program can be compiled for a very wide variety of computer platforms and operating systems with little or no change to its source code. The language has become available on a very wide range of platforms, from embedded microcontrollers to supercomputers.Like most imperative languages in the ALGOL tradition, C has facilities for structured programming and allows lexical variable scope andrecursion, while a static type system prevents many unintended operations. In C, all executable code is contained within functions. Function parameters are always passed by value. Pass-by-reference is achieved in C by explicitly passing pointer values. Heterogeneous aggregate data types (struct) allow related data elements to be combined and manipulated as a unit. C program source text is free-format, using the semicolon as a statement terminator (not a delimiter).
C also exhibits the following more specific characteristics:
- non-nestable function definitions, although variables may be hidden in nested blocks
- partially weak typing; for instance, characters can be used as integers
- low-level access to computer memory by converting machine addresses to typed pointers
- function pointers allowing for a rudimentary form of closures and runtime polymorphism
- array indexing as a secondary notion, defined in terms of pointer arithmetic
- a preprocessor for macro definition, source code file inclusion, and conditional compilation
- complex functionality such as I/O, string manipulation, and mathematical functions consistently delegated to library routines
- around 30 reserved keywords
- syntax divergent from ALGOL, often following the lead of C’s predecessor B, for example using
{ ... }rather than ALGOL’sbegin ... end- the equal-sign for assignment (copying), much like Fortran
- two consecutive equal-signs to test for equality (compare to
.EQ.in Fortran or the equal-sign in BASIC) &&and||in place of ALGOL’sandandor, which- are syntactically distinct from the bit-wise operators
&and|(used by B for both meanings) - never evaluate the right operand if the result can be determined from the left alone (short-circuit evaluation)
- are syntactically distinct from the bit-wise operators
- a large number of compound operators, such as
+=,++, etc
Well Now since you got an insight on what C is i would like to hand you some programming codes: A MATH PROGRAMCode:#include<iostream> #include <cmath> #include <ctime> using namespace std; int main(void) { system("TITLE math help"); system("COLOR 0c"); char cChar; double dnumber1; double dnumber2; double dnumber3; double danswer; char cDoagain; int iGumballs; do { system("CLS"); cout << "please enter the number" << endl << "1 = calculator" << endl << "2 = average" << endl << "3 = equation solver" << endl<< "4 = circles" << endl<< "5 = rectangle"<< endl<< "6 = squares" << endl << "7 = games"<< endl; cin>> cChar; switch (cChar) { case '7': int iGumballs; int iUserguess; int iGuess = 0; while (true) { srand(static_cast<unsigned int>(time(0))); iGumballs = rand()%1000+1; cout<<"What number is the computer thinking of? You guess."<< endl; do { cin>> iUserguess; if(iUserguess > iGumballs) { cout<<"to high!! Guess again."<< endl; } if(iUserguess < iGumballs) { cout<<"to low!! guess again."<< endl; } iGuess++; }while(iUserguess > iGumballs || iUserguess < iGumballs); cout<<"your guessed the right number!!!!"<< endl; cout<<"you took"<< iGuess <<"guesses"<< endl; } } switch (cChar) { case '6': int choice(0); double s; double a; double v; double p; cout<<"please choose one"<< endl<<"1 = squares"<< endl<<"2 = cubes"<< endl; cin>> choice; if(choice == 1) { cout<<"please enter the side of the square"<< endl; cin>> s; p = s+s+s+s; a = s*s; cout<<"the primiter of the cube is: "<< p<<"the area of the cube is: "<<a<< endl; } if(choice == 2) { cout<< "please enter the side of the square"<< endl; cin>> s; v = s*s*s; a = 6*s*s*s; cout<<" the surface area of the cube is: "<< a<<" the volume of the cube is: "<< v << endl; } } switch (cChar) { case '5': int choice(0); double w; double l; double a; double p; double h; double b; double v; cout << "please choose" << endl << "1 = a and p of rectangle"<< endl << "2 = sa and v of rectangle prism" <<endl<< "3 = sa and v of rectangle pyrmid" << endl; cin >> choice; if(choice == 1) { cout << "please enter the lengith of your rectangle" << endl; cin >>l; cout << "please enter the witdth of your rectangle" << endl; cin >>w; a = (l*w); p = (2*l*w); cout << "the primider of your rectangle is:"<< p << endl << " the area of your rectangle is:"<< a<< endl; } if(choice == 2) { cout<< "please enter the lengith"<< endl; cin>>l; cout<<"please enter the base"<< endl; cin>>w; cout<<"please enter the height"<< endl; cin>>h; a = (2*w*h+l*w+l*h); p = l*w*h; cout<<"the surface area of the rectangle prism is: "<< a <<endl<< "the volume of the rectangle prism is: "<<p<<endl; } if(choice == 3) { cout<<"please enter the lengith of the rectangle"<< endl; cin >> l; cout<<"please enter the with of the rectangle"<< endl; cin>> w; cout<<"please enter the height of the triangle"<< endl; cin>> h; a = (2*l*w) + (h*h); v = (l*w*h*.333); cout<< "the surface area of your triangle pyramid is:"<< a <<endl<<"the volume of the triangle pyramid is:"<< v << endl; } } switch (cChar) { case '4': int choice(0); const double PI = 3.14159; double r; double dra; double drc; cout << "please choose spheres or circles" << endl << "1 = v and a of circles" << "2 = v and a of spheres" << endl; cin >> choice; if(choice ==1) { cout << "please enter the radius of the circle" << endl; cin >> r; drc= (r*2)*PI; dra= (r * r)*PI; cout << "the circumference of your circle is:"<< drc << " the area of your circle is:" << dra <<endl; } if(choice ==2) { int choice(0); const double PI = 3.14159; double r; double drv; double dra; cout << "please enter the radius of your sphere" << endl; cin >> r; dra = (4 * PI)*(r*r); drv = (4/3 * PI)*(r*r); cout << "the surface area of the sphere is:"<< dra <<endl<< "the volume of the sphere is:" << drv<< endl; } } switch (cChar) { case '3': double dnumber1; double dnumber2; double dnumberx; cout<< "please enter equation you would like to do in this format(a=bx+c)" << endl; cin >> dnumber1; cin >> dnumber2; cin >> dnumber3; dnumberx = (dnumber1 - dnumber3) / dnumber2; cout<< "your answer is:" << dnumberx<< endl; } switch (cChar) { system("CLS"); case '2': double dnumber1 = 0.0; double dnumber2 = 0.0; double dnumber3 = 0.0; double dadvrage = 0.0; cout<< "please enter the 3 numbers you would like to use"<< endl; cin>> dnumber1; cin>> dnumber2; cin>> dnumber3; dadvrage = (dnumber1 + dnumber2 + dnumber3) / 3; cout<<"your answer is:" <<endl<< dadvrage<<endl<<endl; } switch (cChar) { case '1': cout << "please enter the problem you would like to do " << endl; cin >> dnumber1; cin >> cChar; cin >> dnumber2; switch (cChar) { case '+': cout << "your answer is:" << dnumber1 << " + " << dnumber2 << " = " << (dnumber1 + dnumber2 ) << endl; break; case '-': cout << "your answer is:" << dnumber1 << " - " << dnumber2 << " = " << (dnumber1 - dnumber2) << endl; break; case '*': cout << "your answer is:" << dnumber1 << " x " << dnumber2 << " = " << (dnumber1 * dnumber2) << endl; break; case 'x': cout << "your answer is:" << dnumber1 << " x " << dnumber2 << " = " << (dnumber1 * dnumber2) << endl; break; case 'X': cout << "your answer is:" << dnumber1 << " X " << dnumber2 << " = " << (dnumber1 * dnumber2) << endl; break; case '/': if(dnumber2 == 0){ cout << "that is an invalid opperation!!" << endl; }else{ cout << "your answer is:" << dnumber1 << " / " << dnumber2 << " = " << (dnumber1 / dnumber2) << endl; } break; default: cout << "That is an invalid opperation" << endl; break; } } cout<< " would you like to start again (y or n)?"; cin >> cDoagain; }while(cDoagain == 'Y' || cDoagain == 'y'); system("PAUSE"); return 0; }And YEAH!!!!Another one For THOUGHT: This is just something simple to get you use to local variables,considering the fact I’m wayy too bored, this program will calculate your temperature in degrees F to degrees C ..enjoyCode:#include <iostream> float Convert(float); int main() { using namespace std; float TempFer; float TempCel; cout << "Please enter your designated temperature in Farenheit: "; cin >> TempFer; TempCel = Convert(TempFer); cout << "\nThe designated temperature in Celsius: "; cout << TempCel << end1; return 0; } float Convert(float TempFer) { float TempCel; TempCel= ((TempFer - 32) * 5) / 9; return TempCel; }AND LAST BUT NOT LEAST this is basic encrypter for personal use... is very easy to use it, and you can easly make a decrypter... Compile with VS 2005... #include <iostream> using namespace std; int main(){ int pom,p; cout<<"input lenght of word"<<endl; cin>>p; char rijec[100],t; cout<<"\nfirst input word and than enter encryption move"<<endl; //if you entered 1 for enc move it would transform "a" to "b", //"b" to "c" etc.. if u entered enc move 2 it wold transform "a" to "c", "b" to "d" etc.... cin>>rijec>>pom; cout<<"encrypted string of word: '"<<rijec<<"' is:\n"; for(int i=0;i<p;i++){ t=rijec[i]; t+=pom; cout<<t; } return 0;}