Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
4 votes
2 answers
218 views

I have a _Float16 half-precision variable named x in my C program, and would like to printf() it. Now, I can write: printf("%f", (double) x);, and this will work; but - can I printf x ...
einpoklum's user avatar
  • 138k
1 vote
1 answer
74 views

I have a simple C program using SHA256 to get the hash value of a string: #include <stdio.h> #include <string.h> #include <openssl/sha.h> int main() { unsigned char* ...
skoestlmeier's user avatar
3 votes
3 answers
130 views

In the C standard's C17 draft N2176 document, at 7.21.6.1.8, it says that If no precision is specified, the array shall contain a null wide character. If a precision is specified, no more than that ...
Cinverse's user avatar
  • 333
1 vote
1 answer
195 views

Commands printf 'ABC$def%hx\n' 10 # output: ABC$defa printf 'ABC$def%s\n' 10 # output: ABC$def10 work as expected.... but I cannot find any info about %h. Is it available on all systems?
Antonio Rizzo's user avatar
-3 votes
2 answers
161 views

Is it possible in C++ to use format specifiers in a custom function? Like as in the printf() statement, and how you can use e.g. '%d' to insert an int variable: printf("The number is %d", ...
user avatar
4 votes
2 answers
415 views

I want to portably work with 64-bit signed types in C. However - I know that int64_t is not guaranteed to be defined. I can use some preprocessor magic in my build system generation (e.g. CMake's ...
einpoklum's user avatar
  • 138k
4 votes
1 answer
139 views

I wonder why the code below prints "wrong". double x = 0x8000000000000000; signed long long v1 = (signed long long)(x); signed long long v2 = *(signed long long *)(&x); printf( v1 == v2? ...
PkDrew's user avatar
  • 2,301
1 vote
2 answers
104 views

I would like to print doubles with consistent column width. Theses numbers represent dollar values so I would also like to have no more than two digits after the decimal print. Here I'm intending to ...
Gideon's user avatar
  • 19
0 votes
2 answers
87 views

I'm a beginner learning C programming and I'm wondering the difference between these two formats and why one works and the other does not: // this one doesn't work #include <stdio.h> int main(...
AwkwardLi's user avatar
2 votes
1 answer
125 views

I have an existing code that scans a string and stores values in multiple temporary variables. Here is the sample code: char str[] = "# # Time=80 interval"; char hash1, hash2; char timeStr[...
Priyanka Chauhan's user avatar
-7 votes
1 answer
73 views

enter image description here I tried to print a list using format specifier %s in PYTHON. I thought %s will take only the string value from the list. Why did it take even int and float too. Can ...
rani treasa's user avatar
2 votes
1 answer
314 views

I'm encountering an issue while using the printf() function and I'd like to share the details. The two main sources I'm referring to, cplusplus.com and cppreference.com, indicate that I can use the %f ...
Fatih Ceyhan's user avatar
0 votes
1 answer
81 views

The following code #include <stdio.h> int main() { long long data = 0xFFFEABCD11112345; char *pData = (char *)&data; printf("Value at address %p is %x\n", pData, *...
atta's user avatar
  • 3
4 votes
2 answers
219 views

I have been using tools like iperf3 when using its --timestamps feature that uses strftime under the hood for formatting time. Although I have seen examples that show the conversion specifier %s used ...
kyrlon's user avatar
  • 1,432
0 votes
1 answer
235 views

I'm trying to understand how C is handling the conversion between a pointer and its address. Some courses online (openclassrooms) suggests that displaying a pointer with %d will just convert the hex ...
Frytos's user avatar
  • 13

15 30 50 per page
1
2 3 4 5
33