Computer Science, asked by sheikhheena1424447, 2 months ago

difference between gets() and scanf()​

Answers

Answered by mrsanjusingh78
1

Answer:

The main difference between them is: scanf() reads input until it encounters whitespace, newline or End Of File(EOF) whereas gets() reads input until it encounters newline or End Of File(EOF), gets() does not stop reading input when it encounters whitespace instead it takes whitespace as a string

Explanation:

here is your answer if you like my answer please follow

Answered by OoExtrovertoO
0

ᴛʜᴇ ᴍᴀɪɴ ᴅɪꜰꜰᴇʀᴇɴᴄᴇ ʙᴇᴛᴡᴇᴇɴ ᴛʜᴇᴍ ɪꜱ:

ꜱᴄᴀɴꜰ() ʀᴇᴀᴅꜱ ɪɴᴘᴜᴛ ᴜɴᴛɪʟ ɪᴛ ᴇɴᴄᴏᴜɴᴛᴇʀꜱ ᴡʜɪᴛᴇꜱᴘᴀᴄᴇ, ɴᴇᴡʟɪɴᴇ ᴏʀ ᴇɴᴅ ᴏꜰ ꜰɪʟᴇ(ᴇᴏꜰ) ᴡʜᴇʀᴇᴀꜱ ɢᴇᴛꜱ() ʀᴇᴀᴅꜱ ɪɴᴘᴜᴛ ᴜɴᴛɪʟ ɪᴛ ᴇɴᴄᴏᴜɴᴛᴇʀꜱ ɴᴇᴡʟɪɴᴇ ᴏʀ ᴇɴᴅ ᴏꜰ ꜰɪʟᴇ(ᴇᴏꜰ), ɢᴇᴛꜱ() ᴅᴏᴇꜱ ɴᴏᴛ ꜱᴛᴏᴘ ʀᴇᴀᴅɪɴɢ ɪɴᴘᴜᴛ ᴡʜᴇɴ ɪᴛ ᴇɴᴄᴏᴜɴᴛᴇʀꜱ ᴡʜɪᴛᴇꜱᴘᴀᴄᴇ ɪɴꜱᴛᴇᴀᴅ ɪᴛ ᴛᴀᴋᴇꜱ ᴡʜɪᴛᴇꜱᴘᴀᴄᴇ ᴀꜱ ᴀ ꜱᴛʀɪɴɢ.

Similar questions