Thursday, May 21, 2020

Dereferencing pointer in C++


  • Program :

#include <iostream>
#include <string>
using namespace std;
int main(){
  cout <<"\n----------------POINTERS----------------\n";
  cout <<"\n----------------Dereferencing----------------\n";
   string dish = "Briyani";  // Variable declaration
  string* ptr = &dish;    // Pointer declaration
  // Reference:
  cout << ptr << "\n";
  // Dereference:
  cout << *ptr << "\n";
  return 0;
}




  • Output :


No comments:

Post a Comment

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...