relationship between pointers and arrays (beginners)

#include<iostream>
using namespace std;
int a[]={1,23,22};
int b[]={2323,3};
int main(){
char*point="i love c++ programming ";
char*point1="programming is a new way to think ";
char *point2={"programmers are hardworkers and genius "};
int *p=a;
int*p2=b;

cout<<" the pointer *point = "<<point<<endl;

cout<<" the pointer *point1 = "<<point1<<endl;

cout<<" the pointer *point2 = "<<point2<<endl;

cout<<endl<<endl<<" note that char pointer recieve special treatment in c++ and so if we want to output char pointer  we need not place pointer with its"<<
" name but in case of int pointer we have to place pointer in order to print it "<<endl;

cout<<" the ponter *p = "<<*p<<endl;

cout<<" the ponter *p2 = "<<*p2<<endl;

}



Previous
Next Post »

Comments:

Disqus Shortname