C language is developed on 1972 by Dennis M. Ritchie. C++ is an enhanced, object-oriented version of the C coding language, created in 1979 by Bjarne Stroustrup. The C++ language is perhaps best known for powering many of today’s computer games. So if you want to become a game developer, C++ is the language for you.

Also, because C++ is lower-level than most commonly used languages today, the range of software that you can write in C++ is much wider than in a high-level web language. You could even write a complete operating system!

Here are 4 of Code Conquest’s top C++ training recommendations. There’s something from every category – free and premium, online and offline, basic and extensive, hands-on and theoretical. Guaranteed, one is the perfect training for you.

BASIC COMMANDS IN C PROGRAMMING TO WRITE BASIC C PROGRAM:

Below are few commands and syntax used in C programming to write a simple C program. Let’s see all the sections of a simple C program line by line.

S.no Command Explanation
1 #include <stdio.h> This is a preprocessor command that includes standard input output header file(stdio.h) from the C library before compiling a C program
2 int main() This is the main function from where execution of any C program begins.
3 { This indicates the beginning of the main function.
4 /*_some_comments_*/ whatever is given inside the command “/*   */” in any C program, won’t be considered for compilation and execution.
5 printf(“Hello_World! “); printf command prints the output onto the screen.
6 getch(); This command waits for any character input from keyboard.
7 return 0;
This command terminates C program (main function) and returns 0.
8 }
This indicates the end of the main function.

1. C BASIC PROGRAM:

#include <stdio.h>
int main()
{
/* Our first simple C basic program */
printf(“Hello World! “);
getch();
return 0;
}                                                                                                                                                                                                    .

OUTPUT:

Hello World!

Basic Terms:

Variables:

Variables are simply names used to refer to some location in memory – a location that holds a value with which we are working. It may help to think of variables as a placeholder for a value. You can think of a variable as being equivalent to its assigned value.

Constant:

A “constant” is a number, character, or character string that can be used as a value in a program. Use constants to represent floating-point, integer, enumeration, or character values that cannot be modified. Csupports several types of constants that I am discussing in this article.

Float:

Float is short for floating point and is a fundamental (i.e. built into the compiler) type used to define numbers with fractional parts. The float type can represent values ranging from approximately 1.5 × 1045to 3.4 × 1038 with a precision of 7 digits. There is also a double.

Operator:

An operator is a symbol that tells the compiler to perform specific mathematical or logical functions. C language is rich in built-in operators and provides the following types of operators −

  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
  • Bitwise Operators
  • Assignment Operators
  • Misc Operators
    Operator Description Example
    + Adds two operands. A + B = 30
    Subtracts second operand from the first. A − B = -10
    * Multiplies both operands. A * B = 200
    / Divides numerator by de-numerator. B / A = 2
    % Modulus Operator and remainder of after an integer division. B % A = 0
    ++ Increment operator increases the integer value by one. A++ = 11
    Decrement operator decreases the integer value by one. A– = 9

     

Loops:

In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached. Typically, a certain process is done, such as getting an item of data and changing it, and then some condition is checked such as whether a counter has reached a prescribed number.

There are Three Loops in C/C++ Programing Language:

  • FOR Loop
  • WHILE Loop
  • DO-WHILE Loop

Arrays:

An array is a collection of data items, all of the same type, accessed using a common name. A one-dimensional array is like a list; A two dimensional array is like a table; The C language places no limits on the number of dimensions in an array, though specific implementations may.

Pointers:

A pointer is a variable which contains the address in memory of another variable. We can have a pointer to any variable type. The unary or monadic operator & gives the “address of a variable”. The indirection or dereference operator * gives the “contents of an object pointed to by a pointer”.

A pointer is just like an int: a number. It happens to be a number that identifies a memory location, and if something is stored in that memory location you can call it an address. Like an int, a pointer can be stored in a variable. A variable that stores apointer could be called a pointer variable.

Functions:

A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions.

Download Full Tutorials Here!

Some Basic Examples of Programs Which will help you in learning C/C++: