You can specify a width on string fields, e.g.
printf("%-20s", "initialization...");
And then whatever’s printed with that field will be blank-padded to the width you indicate.
The -
left-justifies your text in that field.
More Related Contents:
- String manipulation in C (replace & insert characters)
- How do you allow spaces to be entered using scanf?
- Why doesn’t scanf need an ampersand for strings and also works fine in printf (in C)?
- How do I print a non-null-terminated string using printf?
- Using printf with a non-null terminated string
- Does C have a string type? [closed]
- String termination C/C++ char = 0
- ‘ ‘, ‘\n’ , scanf() and output screen
- char c[]=”Albus”; printf(“%c”, c); [closed]
- How do I concatenate const/literal strings in C?
- How to convert a string to integer in C?
- How do I trim leading/trailing whitespace in a standard way?
- Correct format specifier for double in printf
- Using the equality operator == to compare two strings for equality in C [duplicate]
- printf(“%p”) and casting to (void *)
- strcmp on a line read with fgets
- Printf variable number of decimals in float
- How to format a number using comma as thousands separator in C?
- Case Insensitive String Comparison in C
- Reading a string with spaces with sscanf
- Correct format specifier for return value of sizeof() in C
- C Strings Comparison with Equal Sign
- Literal string initializer for a character array
- Variable sized padding in printf
- printf of a size_t variable with lld, ld and d type identifiers
- How does strcmp() work?
- Why do strings in C need to be null terminated?
- Assign string to element in structure in C
- What is the difference between %f and %lf in C?
- Assigning char array a value in C