CPP Questions
CPP Questions
what is pointer :
A pointer is a variable that stores the memory address of another variable. It allows you to directly
access and manipulate the memory loca�on.
Exampale:
#include <stdio.h>
int main() {
return 0;
2 ]write a 2 number
swap : #include <iostream>
int main()
int a = 5, b = 10;
cout << "a = " << a << ", b = " << b << endl;
a = a + b;
b = a - b;
a = a - b;
return 0;
pointer:
#include <iostream>
using namespace std;
Call by Address:
The address of the actual parameter is passed to the
func�on.
Changes made inside the func�on affect the original variable.
void modify(int* x) {
*x = 10; // changes the original value
}