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

Encode and Decode Strings - NeetCode.IO Solution by me + gemini pro 3.0 explained

  class Solution {         // encode: List of Strings -> String     public String encode ( List < String > strs) {         Stri...