I have following code.
1 #include <stdio.h>
2 #include <string.h>
3 
4 void encryptString2(char *encryptedString)
5 {
6   
7   while (*encryptedString)
8   {   
9       *encryptedString = *encryptedString ^ 31;
10      printf("Encrypted Character : %c\n", *encryptedString);
11      encryptedString++;  
12  }
13}
14
15 int main(int argc, char* argv[])
16 {
17  char *inputString = "Nahid";
18  printf("Input string : %s\n", inputString);
19  encryptString2(inputString);
20  printf("Input String : %s\n", inputString);
21 }
when i compile in visual studio line 9 causes problem. It shows
Unhandled exception at 0x000B1AA4 in Page_182.exe: 0xC0000005: Access violation writing location 0x000B5C40.
Can anybody explain why this error occurs and how to solve the problem? Thanks in advance.
 
     
    