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.
Related Posts:
- How to format strings using printf() to get equal length in the output
- Data argument not used by format strings in C
- How do you allow spaces to be entered using scanf?
- How can you print multiple variables inside a string using printf?
- Simple way to check if a string contains another string in C?
- Is there a way to have printf() properly print out an array (of floats, say)?
- Proper way to empty a C-String
- How to write to a file using open() and printf()?
- Does C have a string type?
- Tokenizing strings in C
- What do \t and \b do?
- realloc(): invalid next size when reallocating to make space for strcat on char *
- write() to stdout and printf output not interleaved?
- Split string with multiple delimiters using strtok in C
- Pointer to a string in C?
- Convert long long to string in C?
- How do I check if a string contains a certain character?
- Convert Char to String in C
- How many spaces for tab character(\t)?
- How to convert an int to string in C?
- Correct format specifier for double in printf
- Scanf/Printf double variable C
- How to convert a string to integer in C?
- What is the difference between char s[] and char *s?
- printf() formatting for hexadecimal
- Printing hexadecimal characters in C
- How do I properly compare strings in C?
- What is the printf format specifier for bool?
- How to convert an int to string in C?
- What does strcmp() exactly return in C?
- How to printf “unsigned long” in C?
- How I can print to stderr in C?
- How do I create an array of strings in C?
- How to check if a string is a number?
- How to convert integer to string in C?
- How do I create an array of strings in C?
- printf with std::string?
- How do I concatenate const/literal strings in C?
- Split string with delimiters in C
- How to do scanf for single char in C
- Break statement not within loop or switch in C
- How to properly malloc for array of struct in C
- Where is the C auto keyword used?
- How can one print a size_t variable portably using the printf family?
- Bind failed: Address already in use
- Warning/error “function declaration isn’t a prototype”
- %i or %d to print integer in C using printf()?
- How to prevent multiple definitions in C?
- How to pass 2D array (matrix) in a function in C?
- C dynamically growing array
- Why should we check WIFEXITED after wait in order to kill child processes in Linux system call?
- Mapping a numeric range onto another
- Why are hexadecimal numbers prefixed with 0x?
- too many arguments for format [-Wformat-extra-args]
- cast to pointer from integer of different size, pthread code
- Invalid type argument of unary ‘*’ (have ‘int’) Error in C
- Why do I get “cast from pointer to integer of different size” error?
- C subscripted value is neither array nor pointer nor vector when assigning an array element value
- error: too few arguments to function `printDay’ (C language)
- Where to find the complete definition of off_t type?
- How to print a string in C++
- struct has no member named
- printf not printing to screen
- Assembly x86 – “leave” Instruction
- C’s printf and fprintf(stdout,) are not printing
- Convert Little Endian to Big Endian
- Excess elements of scalar initializer for pointer to array of ints
- How does one represent the empty char?
- Using floats with sprintf() in embedded C
- Which of sprintf/snprintf is more secure?
- Can I define a function inside a C structure?
- Where is the
header file on Linux? Why can’t I find ? - Why is the sizeof(int) == sizeof(long)?
- Passing string to a function in C – with or without pointers?
- Trim a string in C [duplicate]
- How to repeat a char using printf?
- How to concatenate string and int in C?
- How to allocate array of pointers for strings by malloc in C?
- How to display hexadecimal numbers in C?
- Standard function to replace character or substring in a char array?
- How do you format an unsigned long long int using printf?
- What primitive data type is time_t? [duplicate]
- Reading float using scanf in c
- “-bash: gcc: command not found” using cygwin when compiling c?
- Why and when to use static structures in C programming?
- Where does linux store my syslog?
- Example of waitpid() in use?
- Can a function return two values?
- C: warning: excess elements in array initializer; near initialization for ‘xxx’ ; expects ‘char *’, but has type ‘int’
- How to know what the ‘errno’ means?
- Printf was not declared in this scope
- warning: missing terminating ” character [enabled by default]
- How to free memory from char array in C
- Can I get Unix’s pthread.h to compile in Windows?
- Initializing 2D char array in C
- FFT in a single C-file
- Process exited with return value 3221225477
- malloc(sizeof(int)) vs malloc(sizeof(int *)) vs (int *)malloc(sizeof(int))
- %p Format specifier in c
- Level vs Edge Trigger Network Event Mechanisms