I meet a problem with the char array size. I pass an char array into the function and after run the function, I still want to use sizeof to check the size of the array, it won't give me the new size of the array, but the old size? I would like to know why? Thank you very much!
#include<iostream>
using namespace std;
void replacement(char* arr, int len){
   int count=0;
   for(int i=0; i<len; i++){
     if(arr[i]==' '){
       count++;
     }
   }
   int newlen=count*2+len;
  //arr[newlen]='\0';
   int k=newlen-1;
   for(int i=len-1; i>=0; i--){
     if(arr[i]!=' '){
        arr[k--]=arr[i];
     }
     else{
       arr[k--]='0';
       arr[k--]='2';
       arr[k--]='%';
     }
   }
}
int main(){
  char arr[]="ab c d e  g ";
  cout<<sizeof(arr)<<endl;
  replacement(arr, sizeof(arr));
 int i=0;
  while(arr[i]!=NULL) cout<<arr[i];  
}
 
     
     
     
    