I'm reviewing the strings, they say that every string will always end in '\0' , that is, that '\0' occupies a space but in this code I define dimension 4: name[4] , it should accept only 3 characters + '\0', but it accepts 4 characters??
#include<stdio.h>
int main() {
char nombre[4]="Hola";
printf("El saludo es: %s",nombre);
return 0;
}
El saludo es: Hola
--------------------------------
Process exited after 1.077 seconds with return value 0
Presione una tecla para continuar . . .
I think that it should throw ERROR from the beginning or, failing that, it should only print "Hello" but it prints "Hello" why? I have tried dev-c++ and gcc on ubuntu 18