5
Contributors
7
Replies
16
Views
5 Years
Discussion Span
Last Post by Suchita_1
0

AND ALSO WHATS THE ERROR IN THE GIVEN CODE

#include <iostream>
#include <stdio.h>

using namespace std;
void all(char *str,int pos)
{
*(str)+pos='h';
printf("%s",*str);
}
int main()
{
char *s="the";
all(s,0);
return 1;
}
0

I smell homework.

Read up in your reference book on implementation of pointers.

Edited by Red Goose: n/a

0

its not homework..i forgot all the concept..bt i rmbrd nw bt still i m having problem in this prog if u cld help

#include <iostream>
#include <stdio.h>
using namespace std;
char *c[]={"ENTNG", "NST","AMAZI","FIRBE"};
//fibre,amazi,nst,entng
char** cp[]={c+3, c+2, c+1, c};
char ***cpp= cp;

int main() {
printf("%s \n",***cpp);

printf("%s \n ",**++cpp);
printf("%s \n",**cpp);
printf("%s \n",*--*++cpp+3);
printf("%s \n",*cpp[-2]+3);
printf("%s \n",cpp[-1][-1]+1);
return 1;
}

output is "amazing best"
i want to know how??

0

*--*++cpp+3 cpp[-1][-1]+1 I challenge you to find a place where either of these are even remotely necessary.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.