Training Report On C and C++
Training Report On C and C++
Uses Of C Programming?
● Operating Systems
● Language Compilers
● Assemblers
Basic Terms In C Programming
Variable
The variable is the container that holds the data. A variable definition tells the compiler where and how
much storage to create for the variable.
Semicolon
In a C program, the semicolon is a statement terminator. That is, each statement must be ended with a
semicolon. It indicates the end of one logical entity.
printf("Hello, World! \n");
Comments
Comments are like helping text in your C program and they are ignored by the compiler. They start
with /* and terminate with the characters */ as shown below −
/* my first program in C *
Basic Data Type In C Programming
Data Type Size Description
Let us look at a simple code that would print the words "Hello World" −
#include <stdio.h>
int main() {
/* my first program in C */
printf("Hello, World! \n");
return 0;
}
Function In C
A function is a group of statements that together perform a task.
Defining A Function In C
The general form of a function definition in C programming language is as follows
−
return_type function_name( parameter list ) {
}
Pointers In C
Some C programming tasks are performed more easily with pointers, and other
tasks, such as dynamic memory allocation, cannot be performed without using
pointers. So it becomes necessary to learn pointers to become a perfect C
programmer.
What Is Pointer ?
A pointer is a variable whose value is the address of another variable.
The general form of a pointer variable declaration is −
type *var-name;
Introduction to c ++
● C++ was developed by Bjarne Stroustrup starting in 1979 at Bell Labs.
● C++ is a cross-platform language that can be used to create high-performance
applications.
FUNCTION OVERLOADING
Example
int myFunction(int x)
float myFunction(float x)
double myFunction(double x, double y)
Pointers And Reference Variable In C++
Pointers In C++
A pointer is a variable whose value is the address of another variable.
References In C++
Everything in C++ is associated with classes and objects, along with its attributes and
methods.
Attributes and methods are basically variables and functions that belong to the class. These
are often referred to as "class members"
To use the data and access functions defined in the class, we need to create objects
Constructor
A constructor in C++ is a special method that is automatically called when an object of a class
is created.To create a constructor, use the same name as the class, followed by parentheses ():
Access
In C++, thereSpecifier
are three access specifiers:
C provides malloc() and calloc() functions C++ provides new operator for memory
for dynamic memory allocation, and free() allocation and delete operator for memory
for memory de-allocation. de-alloca
THANK YOU