#include<stdio.h>
#include<string.h>
void terminateString(char *str){
    str[3] = 0;
    printf("string after termination is:%s\n",str);
}
int main(){
    char str[]="abababcdfef";
    terminateString(str);
    return 0;
}
Output:
string after termination is:aba
We are only assigning element at index '3' to 0, but why are all characters after that index are ignored? Can someone please explain this behavior?
 
     
     
     
     
     
    