ls gives different output: called directly v.s. redirected [duplicate]

bash-5.2$ ls
a    b    c
bash-5.2$ ls > c  &&  cat c
a
b
c

The second command gives output with a newline at the end of each filename.

Why this difference?
Does ls know it’s being redirected? If so, how can I customize this behavior?


version of the relevant software:

$ which bash
/usr/bin/bash
$ bash --version | head -n 1 -
GNU bash, version 5.2.26(1)-release (x86_64-redhat-linux-gnu)
$ which ls
/usr/bin/ls
$ ls --version | head -n 1 -
ls (GNU coreutils) 9.4