vendredi 8 mai 2015

where is the error in the code of string reverse.c programming?

I want to use pointers to reverse a string and store it to new Array but my code is not working:

#include<stdio.h>
#include<conio.h>
char A[80]="This is the String";
char B[160];
int main(){

  int size=(sizeof(A)/sizeof(A[0]));
  char *pA;
  char *pB;
  pA=A;
  pB=(B+size);
  puts(A);
  while(*pA!='\o')
  {
     *pB--=*pA++;
  }

  puts(B);

  return 0;
}

Aucun commentaire:

Enregistrer un commentaire