N
N
nikoosya2021-10-03 10:40:52
C++ / C#
nikoosya, 2021-10-03 10:40:52

How to remove the "Flag ' ' results in undefined behavior with 's' conversion specifier" warning?

They asked me to do a laboratory work in the C language and warnings pop up, I can’t find solutions on the Internet, I’m afraid that the teacher will dig into any slightest mistake. The task is to make a table in the console that displays the range of values ​​for float (it is important to make the table through a flag that fills the string with zeros). The warning appears on the lines " printf("%0 65s \n", "");". Below I will attach the code and screenshots of the errors. Thank you very much in advance

#include <stdio.h>
#include <locale.h>
#include <limits.h>
#include <float.h>

double x;

int main(void)
{
    printf("%0 65s \n", "");
    printf("| %-13s", "Type");
    printf("| %-5s", "Byte");
    printf("| %-21s", "Min Value");
    printf("| %-17s", "Max Value");
    printf("| \n");
    printf("%0 65s \n", "");
    printf("| %-13s", "Type");
    printf("| %-5d", sizeof(x));
    printf("| %-21e", DBL_MIN);
    printf("| %-17e", DBL_MAX);
    printf("| \n");
    printf("%0 65s \n", "");
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stepan Bryuzgin, 2021-10-04
@cybersonner

printf("%065s \n", "");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question