+ 1
Please help me
The first code works but second doesn't. Why? It's something with the format specifiers https://code.sololearn.com/c3tA6FIq8p1t/?ref=app https://code.sololearn.com/ccYWg6e8E0YB/?ref=app
10 Respostas
+ 4
See the warning from compiler:
"/Playground/file0.c: In function 'main':
/Playground/file0. c:10:40: warning: conversion lacks
type at end of format FWformat=
101 printf "The decimal equivalent is: %l", li1);"
Conversion lacks type at end of format. This tells us that 'l' stands for 'long', which is a type modifier, it doesn't represent a data type, although it does modify the meaning of a type, and adjusts accordingly how compiler treats the data.
That was what XXX and Carbon was saying I guess.
+ 4
Rishi,
It's not working (got a warning) because '%l' only defines the type modifier (long), but not the actual data type.
"conversion lacks type at end" warning tells us to also define the type ('i' or 'd') apart from the type modifier 'l' in the conversion specifier.
That's just about it I guess ...
+ 3
Because you used the wrong format specifier in the second code. See the tables in the following link to see all the format specifiers
https://www.cplusplus.com/reference/cstdio/printf/
+ 2
You did not give us what is your program supposed to do, but i will answer you my way. To avoid all issues remove the unused variables 'pEnd' and instead of this:
printf ("The decimal equivalent is: %l", li1);
Use this: "printf ("The decimal equivalent is: %ld", li1);" or this: " printf ("The decimal equivalent is: %li", li1); "
+ 2
Rishi,
It's just a nickname,
Never mind ...
+ 1
Ipang yes yes that's right but I remember studying that "%l" and "%li" are the same. Isn't that right? Then why does my code work only with "%li" and not "%l"?
+ 1
Ipang okay thank you. I think I got it
+ 1
Ipang your name is funnyđ„ș
0
Ipang đ„șđ„șđ„ș