0 votes 0 votes #include<stdio.h> int main() { int i=0; for(printf(" one\n "); i < 3 && printf(" "); i++) { printf("Hi!\n"); } return 0; } shiva0 asked Jul 14, 2018 shiva0 1.4k views answer comment Share Follow See all 7 Comments See all 7 7 Comments reply Naveen Kumar 3 commented Jul 14, 2018 reply Follow Share one Hi! Hi! Hi! 0 votes 0 votes gauravkc commented Jul 14, 2018 reply Follow Share (space)one (space)(space)Hi (space)Hi (space)Hi 0 votes 0 votes shiva0 commented Jul 14, 2018 reply Follow Share how? can you explain.. 0 votes 0 votes gauravkc commented Jul 14, 2018 reply Follow Share A for loop is defined as for(initialization ; Condition ; Increment/Decrement) { statements } Initialization is done only once. Then condition is checked. And then, statement execution -> Increment / Decrement -> Condition check is carried out in a loop fashion. Try it now :) Also, if you are confused how i < 3 && printf(" ") works. printf function returns the number of characters it printed successfully. Note that you are printing one character (space) here. 0 votes 0 votes Mayankprakash commented Jul 14, 2018 reply Follow Share @gaurav Nice explained. My doubt is in intialization part of loop -> printf should return 3 as it contains 'one' so variable 'I' should be initialised to 3 than 0. Please suggest Thanks 0 votes 0 votes gauravkc commented Jul 14, 2018 reply Follow Share printf(" one\n ") will return 6. As there are 6 characters between double quotes. Characters include not only alphabets but also space, newline, punctuation marks, etc. Note that \n is considered as one char as it represents a new line. Also, there is space before and after the string. The value returned by printf is not assigned to i. Hence i will still be 0 (as initialized before entering loop) 0 votes 0 votes shiva0 commented Jul 14, 2018 reply Follow Share @gauravkc Thank you! Nice explanation.!!!! 0 votes 0 votes Please log in or register to add a comment.