Blog
23rd Jun 2018

Learn Basics Of C/C++ And Explore Coding Opportunities

Posted by : Administrator
Comment : 0
Learn Basics Of C/C++ And Explore Coding Opportunities

The era we live in today is a technological era. Technology is everywhere around us from a smartphone in our hands to the automotive cars that we use to travel. But the only question here is that how do these things work without any kind of human efforts? The answer is programming. All these things are programmed to perform certain types of tasks in a specific manner. Our future lies in programming, therefore, learning to be an expert in any programming language will be very much beneficial. But to be a professional, from where we should start? The answer to this question lies in C and C++.

They are the most common and known languages today. Each and every programmer started with C and C++ and then proceeded to other high-level languages. Therefore, further in this article, we will learn the basics of C and C++.

Basics of C:

C is a general-purpose and imperative computer programming language that was designed by Dennis Ritchie at Bell Labs in 1972. Here are some basics of c language.

  • Example C Program:


    #include
    int main()
    {
    /*_some_comments_*/
    Printf (“Hello_World! “);
    getch();
    return 0;
    }

  • Syntax of the program:

    The syntax of the program is following by the exact numbering that is been given to the above program.


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

Basics of C++:

C++ is a general-purpose object-oriented programming (OOP) language, developed by Bjarne Stroustrup, and is an extension of the C language. Here are some basics of C++ language.

  • Example Program:

    #include
    using namespace std;
    int main()
    {
    cout << "Hello this is C++"; }

The syntax of the program:

  • Header files are included at the beginning just like in C program. Here iostream is a header file which provides us with input & output streams. Header files contained predeclared function libraries, which can be used by users for their ease.

  • Using namespace std, tells the compiler to use the standard namespace. Namespace collects identifiers used for class, object and variables. The namespace can be used by two ways in a program, either by the use of using statement at the beginning, like we did in the above-mentioned program or by using the name of the namespace as a prefix before the identifier with scope resolution (::) operator. Example : std::cout << "A";

  • main(), is the function which holds the executing part of the program its return type is int.

  • cout <<, is used to print anything on the screen, same as printf in C language.

  • cin and cout are same as scanf and printf, the only difference is that you do not need to mention format specifiers like %d for int etc, in cout & cin.

No comments, be the first one to comment !

    Leave a Reply

    GET FREE CONSULTATION

    Call Us Now For Free Consultation97370 05566

    Our experts listen to you patiently and suggest you the right course after conducting a personality profile test. Register your interest below to schedule personality profile test for you.

    SUBSCRIBE TO OUR NEWSLETTER

    Contact Us

    Working Hours

    • Monday9:00 AM – 9:00 PM
    • Tuesday9:00 AM – 9:00 PM
    • Wednesday9:00 AM – 9:00 PM
    • Thursday9:00 AM – 9:00 PM
    • Friday9:00 AM – 9:00 PM
    • Saturday9:00 AM – 9:00 PM
    • SundayClosed
    Copyright 2016-2018 Smart Mentors. All Rights Reserved.

    Login

    EXISTING MEMBER LOGIN

    FORGOT PASSWORD

    Sign up now to Become An Instructor

    Register your Interest