In C, what is the effect of a negative number in a field width specifier?
(A) the values are displayed right justified
(B) the values are displayed centered
(C) the values are displayed left justified
(D) the values are displayed as negative numbers
Explanation: To left justify, use a negative number in the field width:
printf("NYU has %-10d students", numStudents);
// NYU has 35123 students
So, option (C) is correct.
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.