1#include <iostream>
2using namespace std;
3int main(){
4 //Pointer declaration
5 int *p, var=101;
6
7 //Assignment
8 p = &var;
9
10 cout<<"Address of var: "<<&var<<endl;
11 cout<<"Address of var: "<<p<<endl;
12 cout<<"Address of p: "<<&p<<endl;
13 cout<<"Value of var: "<<*p;
14 return 0;
15}
1/* memset example */
2#include <stdio.h>
3#include <string.h>
4
5int main ()
6{
7 char str[] = "almost every programmer should know memset!";
8 memset (str,'-',6);
9 puts (str);
10 return 0;
11}
12
13Output: ------ every programmer should know memset!
1/* memset example */
2#include <stdio.h>
3#include <string.h>
4
5int main ()
6{
7 char str[] = "almost every programmer should know memset!";
8 memset (str,'-',6);
9 puts (str);
10 return 0;
11}