what does this symbol mean in c++

Posted on 2009-04-29
Last Modified: 2013-12-14
hi, i have come across some sample code and would just like to know what this means?

declared as
int f1=0


what is the += doing?

thanks in advance
Question by:kipl20
    LVL 39

    Accepted Solution

    The += mean add the value on the right to the variable on the left. In this case f1 will end up having a value of one after the += 1

    Author Comment

    thanks sage
    LVL 39

    Expert Comment

    All the important C++ operators, with good descriptions, can be found here
    LVL 40

    Expert Comment

    short hand for

    f1 = f1 + 1

    In general, any operators of that form (+=, -=, /=, *= and %= and so forth are shorthand for)

    x <operator>= y

    are shorthand for

    x = x <operator> y

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Suggested Solutions

    What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
    This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
    The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
    The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now