Skip to main content
Filter by
Sorted by
Tagged with
4 votes
2 answers
209 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
  • 137k
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
-3 votes
2 answers
155 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
1 answer
136 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,281
0 votes
2 answers
79 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
-7 votes
1 answer
67 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
0 votes
1 answer
74 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
0 votes
1 answer
217 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
0 votes
4 answers
204 views

So, here's my C code. While I was toying with my code in order to learn the format specifiers, especially %c: #include <stdio.h> void main() { double a = 0.21; printf("%c", a);...
utkarsh.naman's user avatar
1 vote
2 answers
311 views

I have been working in C for a couple months now and it has never come to my mind to check where actually the format specifiers implemented/defined in the C language format specifiers like: %f %d %p %...
Bishop's user avatar
  • 57
1 vote
2 answers
3k views

I am trying to print hexadecimal values in C. A simple known program to print hexadecimal value...( Using %x or %X format specifier) #include<stdio.h> int main() { unsigned int num = 10; ...
ASWIN's user avatar
  • 19
6 votes
2 answers
225 views

Consider the following printf instruction: printf("%# 01.1g", 9.8); what should it print? I'm reading the description of the g specifier on cppreference.com, which says (text for G removed):...
einpoklum's user avatar
  • 137k
0 votes
2 answers
143 views

The following loop would run only when off which is uint64_t is less than the value returned by ceil which is double. However I don't see the loop being executed. #include <bits/stdc++.h> using ...
H Kumar's user avatar
  • 47
1 vote
3 answers
812 views

What is the point of format specifier in C if we have allready set the type of variable before printf? For example: #include<stdio.h> int main(void) { int a=7 printf("%d", a); }...
jeaq's user avatar
  • 43
0 votes
0 answers
43 views

I get some warnings from my IDE (Code:Blocks, Win64) when i use %llu as format specifier for unsigned long long in C with printf(). warning: unknown conversion type character 'l' in format warning: ...
Heimo's user avatar
  • 39
0 votes
2 answers
390 views

#include <stdio.h> #include <conio.h> int main() { int a = 2; float b = 4; clrscr(); printf("%d \n", a + b); printf("%f \n", a + b); printf(&...
Sushila Sutar's user avatar
2 votes
1 answer
4k views

I saw in some functions that in order to convert number to hexadecimal format, using this format: printf("%02hhx", some_char); , but I don't understand why, and what is the meaning of this ...
user123454321's user avatar
-5 votes
2 answers
452 views

#include <stdio.h> int main() { signed char ch; ch = 128; printf("%f", ch); return 0; } Can anyone explain why it is printing 0.000 every time?? I tried %f as a format ...
premdanav's user avatar
-1 votes
1 answer
66 views

Hi I've created an array and used malloc to store it so it could use it in a different function but now I'm running into problems with printing the array as it says: warning: format '%d' expects ...
Wolo's user avatar
  • 5
1 vote
1 answer
177 views

I get that %d is the format specifier for type decimal, and %f is for float, but I'm not sure why the output of the 2nd print statement is 3. #include <stdio.h> int main() { float arr[5] = {...
OkCloudy's user avatar
0 votes
1 answer
64 views

The problem is only in the last scanf of the program The following program works perfectly the 1st time, but as soon as I use the again (from the restart/quit goto program in the last), the whole ...
Tauqeer's user avatar
  • 15
-2 votes
1 answer
478 views

Hex value of 6378624653 is : 0x17C32168D But this code prints : 0x7C32168D #include<iostream> int main() { int x = 6378624653; printf("0x%x", x); } can anyone explain why ...
Sourav Sangral's user avatar
2 votes
1 answer
170 views

I want to print a char '=' repeatedly where I give the no. of times the asterisk should be repeated. Example: count = 20 and I want to print ==================== using printf() and format specifiers.
Pranali Hemane's user avatar
0 votes
2 answers
153 views

I found questions about %i and %d on here, but all of them seemed to claim that they were the same in printf. Compiler: Apple clang version 12.0.5 (clang-1205.0.22.9) Note: 15 is 017 in octal and 0xf ...
Clay Smith's user avatar
1 vote
2 answers
831 views

I try to rewrite printf function and i found a strange result when use format specifier (%) with ! or K. I want to understand why i get this result. printf("%!"); printf("%K&...
Dev Beginner's user avatar

1
2 3 4 5
10