+ 3
Why these codes take string greater than the array size and also print them ?
https://code.sololearn.com/cIXDoppKtYk1/?ref=app https://code.sololearn.com/cjNNIcZd69S9/?ref=app
4 odpowiedzi
+ 2
Here when you use %s or gets or puts, these work on pointers. They take variable or array as pointer. So, it doesn't care about what size you mentioned in declaring array. So, it prints everything which is given as input.
+ 1
Or you can use while or do-while loop too.
0
Then we can use a for loop and access specifier %c or get() or put() and iterate till your size of array. It takes one character at a time.