In article <jdbrjd$q24$>,
says...
>
> #include<stdio.h>
>
>
> int *p;
>
> int main(int argc, char *argv[]){
> int i, j, k, n, m;
> if(!chk(argv[1])||!chk(argv[2])){
> printf ("\nUsage p number_1 number_2");
> return 1;
> }
> m=atoi(argv[1]);
> n=atoi(argv[2]);
> p=(int*)malloc(sizeof(int)*n);
> printf("\n======================================== ==\n");
> write(m, m, n);
> printf("\n======================================== ==\n");
> p--;
> write_reverse(n);
> printf("\n======================================== ==\n");
> return 0;
> }
>
>
> write(int i, int m,int n){
> if(n==0)return 0;
> *p=i;
> n--;
> i=i*m;
> printf("%d ", *p);
> p++;
> write(i,m , n);
> }
>
> write_reverse(int n){
> if(n==0)return 0;
> printf("%d ", *p);
> n--;
> p--;
> write_reverse(n);
> }
>
>
> int chk(char *c){
> if(!isdigit(*c) && *c!='\0') return 0;
> if(*c=='\0') return 1;
> *c++;
> chk(c);
> }
1) Provide the proper prototypes for the subroutines at the top of the
file.
2) Declare p inside of main()
3) Add an argument to each of write() and write_reverse() that is a
pointer to a pointer.
4) Call each of the modified write() and write_reverse() functions with
&p in the argument position as added in 3) above.
5) In each of the subroutines that accept this pointer to pointer
argument you'll have to either re-write the code to properly dereference
the passed argument OR add a local pointer that you set to the value of
the dereferenced entry argument.
--
Michael Karas
Carousel Design Solutions
http://www.carousel-design.com