I have this assembly code:
push dword ' You'
push dword 'Hey'
push esp
call printf
It prints only ‘Hey’.
How can I fix it to print ‘Hey You’?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should add a space after the word Hey like so ‘Hey ‘.
Why? because ‘Hey’ is a dword, thats 4 bytes:
'H' 'e' 'y' 0(null),printfprints until the first null, therefore you get only ‘Hey ‘.But ‘Hey ‘ is
'H' 'e' 'y' ' ', and the first null will now be after ‘You’.