Linked Questions

-5 votes
2 answers
2k views

why is that when I print a result from my function, it prints out 0? I tried using a prototype, and followed an example from my teacher, but no dice. Pretty lost here. #define ...
Swice's user avatar
  • 1
1 vote
1 answer
398 views

I can't scan a double to a variable. This is my code, it is very simple. I built it with command: gcc -Wall -Wextra -Wpedantic -ansi -c double.c #include <stdio.h> int main() { double f; ...
mja's user avatar
  • 1,395
0 votes
1 answer
346 views

C++ code for double using cstdio header. #include <cstdio> using namespace std; int main() { double f; scanf("%lf",&f); printf(...
GIRISH kuniyal's user avatar
0 votes
0 answers
59 views

I made two constructors in Vector class. public: Vector() { x = 0; y = 0; z = 0; } Vector(int _x, int _y, int _z) { x = _x; y = _y; z = _z; ...
Keastmin's user avatar
69 votes
7 answers
454k views

I try to read-in 2 values using scanf() in C, but the values the system writes into memory are not equal to my entered values. Here is the code: double a,b; printf("--------\n"); //seperate lines ...
user1880009's user avatar
45 votes
4 answers
9k views

From a previous question: If you attempt to pass a float to printf, it'll be promoted to double before printf receives it printf() is a variadic function right? So does a variadic function promote ...
user avatar
10 votes
5 answers
31k views

I have a double number and I would like to convert it to string. The number is, for example, something like 24.043333332154465777... but if I convert it to string using something like NSString *...
Duck's user avatar
  • 36.2k
7 votes
4 answers
62k views

So I know that there's a large difference in the precision of floats and doubles. I get that. Promise. But, in C++, when calling scanf and printf, the notation used to specify a double is "%lf", and ...
Nealon's user avatar
  • 2,263
7 votes
1 answer
9k views

I'm trying to print a floating point number in x86_64 assembly but it just prints the value as zero. There's a few questions about this already. One appeared to be resolved by ensuring that you set ...
cgmb's user avatar
  • 4,434
5 votes
2 answers
8k views

int main() { char str[10]="3.5"; printf("%lf",atof(str)); return 0; } This is a simple code I am testing at ideone.com. I am getting the output as -0.371627
Naved Alam's user avatar
3 votes
1 answer
4k views

so I want to convert NSString to double. I found the following example: NSString * s = @"1.5e5"; NSLog(@"%lf", [s doubleValue]); It works but if doubleValue cannot convert the string to double it ...
tesla's user avatar
  • 77
1 vote
7 answers
11k views

#include <stdio.h> int main(int argc, const char * argv[]) { float apples = 1.1; float bananas = 2.2; double fruit = apples + bananas; printf("%f.\n",fruit); return 0;...
lfkwtz's user avatar
  • 1,017
9 votes
2 answers
424 views

In the given program why did I get different results for each of the printfs? #include <stdio.h> int main() { float c = 4.4e10; printf("%f\n", c); printf("%f\n", 4.4e10); ...
user10056563's user avatar
2 votes
2 answers
1k views

for the whole day I've been fighting with something I believed being a bug but then (with some nasty printf-debugging) it came out that it was a weird exp math function behaviour ... maybe there's ...
Simone Margaritelli's user avatar
3 votes
2 answers
3k views

Today I decided to recap a bit the C programming language fundamentals and I have encountered this small issue within my Code::Blocks IDE: when I had used the %f format identifier to read and write a ...
Revnic Robert-Nick's user avatar

15 30 50 per page