1 #include <stdio.h>
2
3 int main( int argc, char * argv[]){
4 const char *ptr = "A";
5 /* *ptr = 'R'; */
6 char chararray[1] = {'Y'};
7 printf("%c \n", *ptr);
8 printf("%c \n", *chararray);
9 char tok[] = "Some'unknown text and 'exciting text\n";
10 printf("Your String ==> %s", tok);
11 int size = sizeof(tok)/sizeof(tok[0]);
12 printf("Size of string %d \n", size);
13 int newsize = size *2 +1;
14 char tok2[newsize];
15 char * tok2_place = tok2;
16 char * end = &tok[size];
17 char * place = tok;
18 for(place; place < end; place++, tok2_place++){
19 if(*place == '\''){
20 *tok2_place = '\\';
21 *tok2_place++;
22 }
23 *tok2_place = *place;
24 }
25 printf("New String ==>%s", tok2);
26
27
28
29
30
31 return 0;
32 }
33