char arrays

#include <iostream>
#include<string.h>
using namespace std;

bool findchar(char*cstr,char x,int &n){
cout<<&cstr<<" "<<n<<endl;
for(int i=0;cstr[i]!='\0';i++){
if(cstr[i]==x)return true;
}
return false;
}
int main(){
char name[]="name";

cout<<*name<<endl;
int n=2;
cout<<&name<<" "<<endl<<&name[1]<<endl<<&name+1<<endl;
const char *cstr=name;
int &b=n;
cout<<cstr<<endl<<&cstr<<" "<<&cstr[1]<<" "<<b<<endl<<n<<endl<<&b<<endl<<&n<<endl;
cout<<findchar(name,'i',n);
}
please explain how output is coming?
Please explain how output is coming?

What do you want?
Topic archived. No new replies allowed.