Hello,
I am a relatively new programmer and I had a question about something my teacher went over regarding the %d. Here is an example of the code we were doing:
I understand that 10 will be substituted in for %2d but I also tried executing with %d and got the same output. So what is the significance of the "2" in %2d and what does it do? Thanks a lot.Code:#include <stdio.h> int main() { int k,m; system ("cls"); k = 0; while ( k < 10 ) { printf("Testing, testing 123"); k = k + 1; } printf("\n\n\t\tThe value of k after the above while command is %2d"); }



2Likes
LinkBack URL
About LinkBacks





