insert
Code:
#include <stdio.h>
#include <stdlib.h>
void xstrrev(char *);
int main(){
int i;
static char *s[] = {
"To err is human...",
"But to really mess things up...",
"One needs to know C!!"
};
for(i=0;i<3;i++){
xstrrev(s[i]);
printf("\n\r%s", s[i]);
}
}
void xstrrev(char *a){
int len,j;
char *p, temp;
//printf("\n\r%c", *a);
len = strlen(a);
//printf("\n\r%d %d", len, len/2);
p = a + len -1;
//printf("\n\r%d", p);
for(j = 1;j<= len/2;j++){
temp = *a;
printf("%c %c", temp , *p);
*a = *p;
*p = temp;
a++;
p--;
}
}
I tried usign this approach of pointers but still no success when i try to run it gives me an unhandled exception (i thought only java had exceptions)