C++ notes
C++ notes
#include <iostream>
using namespace std;
int main()
{
Writing First C++ // Prints hello world
Program cout << "Hello World";
return 0;
}
▪ We have used the cout method which is the basic
output method in C++ to output anything in the
standard output stream.
Basic Output- ▪ Syntax:
cout cout <<“ My name is Atul” ;
▪ Note: Every C++ statement except the function
declarations will end with semicolon.
▪ Comments in C++ are meant to explain the code as
well as to make it more readable. The purpose of the
comments is to provide information about code lines.
Programmers commonly use comments to document
their work.
C++ Single-line {
return 0;
}
▪ // C++ Program to demonstrate Multi line comment
#include <iostream>
▪ Types of Tokens in C
▪ The tokens of C language can be classified into six types
based on the functions they are used to perform. The types
of C tokens are as follows:
Tokens in C ▪ Keywords
▪ Identifiers
▪ Constants
▪ Strings
▪ Special Symbols
▪ Operators
▪ The keywords are pre-defined or reserved words in a
programming language. Each keyword is meant to
perform a specific function in a program. Since
1. C Token - keywords are referred names for a compiler, they can’t
be used as variable names because by doing so, we are
Keywords trying to assign a new meaning to the keyword which is
not allowed. You cannot redefine keywords. C language
supports 32 keywords which are given below:
char string[20] = {‘g’, ’e’, ‘e’, ‘k’, ‘s’, ‘f’, ‘o’, ‘r’, ‘g’, ’e’, ‘e’, ‘k’, ‘s’, ‘\0’};
char string[20] = “geeksforgeeks”;
char string [] = “geeksforgeeks”;
▪ Operators are symbols that trigger an action when applied to C
variables and other objects. The data items on which operators
act are called operands.
Depending on the number of operands that an operator can act
upon, operators can be classified as follows: