English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Program to sum the digits of a given number / C ++What is C

Pointer stores memory address. Wild pointer is different from pointer, that is, wild pointer also stores memory address, but points to allocated but unallocated memory or data value. Such pointers are called wild pointers.

When a pointer is declared but not initialized, its behavior is similar to a wild pointer. That is why, they point to any random memory location.

This is C ++Wild pointer example in the language,

Example

#include <bits/stdc++.h>
using namespace std;
int main() {
   int *arr;
   for(int i=0;5 ; i++)
   cout << arr[i] << " ";
   return 0;
}

Output Result

1 0 -426634956 32764 0

In the above program, the pointer arr is declared but not initialized. Therefore, it displays some random memory locations.

int *arr;
for(int i=0;5 ; i++)
cout << arr[i] << " ";