Pages

Saturday, April 5, 2025

What are pointers? in C++

 Pointers are special variable that stores address of another variable.


#include<iostream>

using namespace std;

int main(){
    int a = 10;
    int *ptr = &a;

    int **pptr = &ptr;

    cout << &ptr << " = " << pptr << "\n";

    return 0;
}

OUTPUT-
0x61ff04 = 0x61ff04

No comments:

Post a Comment

3917. Count Indices With Opposite Parity (Brute Force) O(n2) + Optimized Solution O(n) + tips LEETCODE WEEKLY 500

  class Solution {     public int [] countOppositeParity ( int [] nums ) {          // approach 1 - checks every pair         int n = n...