Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions cpp/pointers/pointers.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,32 @@ int main()
return 0;
}
```

### Check result [here](https://onecompiler.com/cpp/3yjazmygf)

## Example
```c
#include<iostream>
using namespace std;

int main(){
char b[]= "abc";

//in char array ptr, ptr does not store the address(unlike integer array)
//but instead prints the whole characters untill it find '\0'

char *p = & b[0]; //prints abc
cout<<p<<endl;

char *q = & b[1]; //prints bc
cout<<q<<endl;

char *r = & b[2]; //prints c
cout<<r<<endl;
}
```

### Check result [here](https://onecompiler.com/cpp/3yjdvzrwk)