I am trying to reverse a word using pointers but the problem that the following line cause error:access violation writting location
0x000...
*temp = *(n+len);
the full code
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<Windows.h>
#include<string.h>
void re(char *n){
int len = strlen(n);
char *temp=NULL;
while (len != 0){
*temp = *(n+len);
len--;
temp++;
}
n = temp;
}
void main(){
char name[] = "yahia";
re(name);
printf("%s \n", name);
system("pause");
}
*microsoft compilar
any help ?