C++ pointer arithmetic
C++
#include <iostream>
using namespace std;
const int MAX = 3;
int main () {
int var[MAX] = {10, 100, 200};
int *ptr;
// let us have array address in pointer.
ptr = var;
for (int i = 0; i < MAX; i++) {
cout << "Address of var[" << i << "] = ";
cout << ptr << endl;
cout << "Value of var[" << i << "] = ";
cout << *ptr << endl;
// point to the next location
ptr++;
}
return 0;
}
Also in C++:
- Title
- correct sequence of compilation process in c++
- Category
- C++
- Title
- c++ initialize array
- Category
- C++
- Title
- How to find the suarray with maximum sum using divide and conquer
- Category
- C++
- Title
- c++ give options
- Category
- C++
- Title
- getting a random letter in c++
- Category
- C++
- Title
- maximum subarray sum equal with K in c++
- Category
- C++
- Title
- longest common subsequence
- Category
- C++
- Title
- case label in c++
- Category
- C++
- Title
- char* to int in cpp
- Category
- C++
- Title
- convert string to stream c++
- Category
- C++
- Title
- how to format decimal palces in c++
- Category
- C++
- Title
- c++ program to input and print text using Dynamic Memory Allocation.loop
- Category
- C++
- Title
- declare vectors c++
- Category
- C++
- Title
- how to ensure the user inouts a int and not anything else c++
- Category
- C++
- Title
- convert decimal to binary in c++
- Category
- C++
- Title
- how to delete something in an array c++
- Category
- C++
- Title
- dijkstra in c++
- Category
- C++
- Title
- pyqt connect
- Category
- C++
- Title
- Convert binary tree to a doubly linked list
- Category
- C++
- Title
- C++ remove element from set
- Category
- C++
- Title
- caesar cipher program in c++
- Category
- C++
- Title
- static variable in c++
- Category
- C++
- Title
- select elements from array C++
- Category
- C++
- Title
- ue4 c++ struct
- Category
- C++
- Title
- make an x using asterisk c++
- Category
- C++
- Title
- c++ how to add something at the start of a vector
- Category
- C++
- Title
- kruskal's algorithm c++ hackerearth
- Category
- C++
- Title
- loop c++
- Category
- C++
- Title
- c++ initialization list
- Category
- C++
- Title
- 1d fixed length arrays c++
- Category
- C++
- Title
- switch c++
- Category
- C++
- Title
- how print fload wiht 3 decimal in c++
- Category
- C++
- Title
- clear console c++
- Category
- C++
- Title
- loop through array c++
- Category
- C++
- Title
- c++ class inheritance
- Category
- C++
- Title
- error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if(s[i] != "b"){
- Category
- C++
- Title
- length of string c++
- Category
- C++
- Title
- c++ while true
- Category
- C++
- Title
- stringstream in c++
- Category
- C++
- Title
- c++ typeid get type name
- Category
- C++
- Title
- sieve of eratosthenes c++
- Category
- C++
- Title
- residuo en lenguaje c
- Category
- C++
- Title
- is TLE means my code is correct but taking more time to computr
- Category
- C++
- Title
- delete a double pointer c++
- Category
- C++
- Title
- variabvles in c++
- Category
- C++
- Title
- reverse in vector c++
- Category
- C++
- Title
- c++ remove item from list
- Category
- C++
- Title
- c++ ternary operator
- Category
- C++
- Title
- c++ class template
- Category
- C++
- Title
- inserting an element in an set c++
- Category
- C++
- Title
- Runtime Error: Runtime ErrorAbort signal from abort(3) (SIGABRT)
- Category
- C++
- Title
- how to check sqrt of number is integer c++
- Category
- C++
- Title
- E/flutter (20384): [ERROR:flutter/third_party/txt/src/minikin/FontFamily.cpp(184)] Could not get cmap table size! E/flutter (20384): F/flutter (20384): [FATAL:flutter/third_party/txt/src/minikin/FontCollection.cpp(95)] nTypefaces == 0
- Category
- C++
- Title
- dfs in c++
- Category
- C++
- Title
- c++ ros publisher
- Category
- C++
- Title
- how to include seld declared header file in c++
- Category
- C++
- Title
- Given an undirected graph, count the number of connected components.
- Category
- C++
- Title
- subarray sum in c++
- Category
- C++
- Title
- c++ char to int
- Category
- C++
- Title
- hohw toparse a string in c++
- Category
- C++
- Title
- opencv compile c++
- Category
- C++
- Title
- maximum subarray sum in c++
- Category
- C++
- Title
- converting char to int in c++
- Category
- C++
- Title
- calling by reference and pointers c++
- Category
- C++
- Title
- vector concat c++
- Category
- C++
- Title
- C++ int to char*
- Category
- C++
- Title
- log base 10 c+_+
- Category
- C++
- Title
- c++ print one line to console instead of multiple
- Category
- C++
- Title
- c++ get last element in vector
- Category
- C++
- Title
- rand c++
- Category
- C++
- Title
- hashset in c++
- Category
- C++
- Title
- convert integer to string c++
- Category
- C++
- Title
- C++ Student::Student()
- Category
- C++
- Title
- for c++
- Category
- C++
- Title
- find_if c++
- Category
- C++
- Title
- c++ unittest in ros
- Category
- C++
- Title
- cin.fail()
- Category
- C++
- Title
- binary representation differ in bits
- Category
- C++
- Title
- calculate factorial
- Category
- C++
- Title
- flushing output in c++
- Category
- C++
- Title
- string to vector c++
- Category
- C++
- Title
- binary tree search
- Category
- C++
- Title
- worker class c++
- Category
- C++
- Title
- c++ pointers
- Category
- C++
- Title
- pop_back
- Category
- C++
- Title
- how to check type in c++
- Category
- C++
- Title
- create new file c++
- Category
- C++
- Title
- declaring 2d vector in c++
- Category
- C++
- Title
- varint index
- Category
- C++
- Title
- what is difference between ciel and floor
- Category
- C++
- Title
- translate
- Category
- C++
- Title
- chess perft 5
- Category
- C++
- Title
- private and public in namespace cpp
- Category
- C++
- Title
- elseif c++
- Category
- C++
- Title
- nth_element c++
- Category
- C++
- Title
- error: invalid use of template-name without an argument list
- Category
- C++
- Title
- how to declare a vector in c++
- Category
- C++
- Title
- how initilaize deffult value to c++ class
- Category
- C++
- Title
- iterate 2d array c++
- Category
- C++
- Title
- calling by reference c++
- Category
- C++