I was reading about how char *arr is different from char arr[]. Now, as in char *arr="Pilani", arr stores the base address of the memory block reserved for Pilani. How, can I change the any character at that particular memory block? arr[0] ='T' gives error.
#include<iostream> using namespace std; int main(){ char *p="Pilani"; // p[0]='K'// does not work. // *(&p[0])='s'; //does not work; cout<<p[0]<<" "<<(void *)p<<" \n"; return 0; } -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.