int *a;
char *c;
*(a) = 20;
*c = *a;
printf("%c",*c);

Recommended Answers

that'll never compile...

Jump to Post

I smell homework.

Read up in your reference book on implementation of pointers.

Jump to Post

All 7 Replies

that'll never compile...

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;
}

I smell homework.

Read up in your reference book on implementation of pointers.

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??

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

for answer refer example 14 page 185 "pointers using C" Yashawant kanetkar

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.