printing double value

From: Edo (eddod_at_eddododod.dod)
Date: 07/29/04


Date: Thu, 29 Jul 2004 02:09:36 -0700

Hello
Why this code does not print
0.0s instead of 0, since it is doubles?

thanks

#include <iostream>
using namespace std;

//args: pointer to an array of doubles, array size
//action: prints each element of an array
void arrayPrint(double* dp, int size){
     for(int i=0; i<size; ++i){cout << dp[i] << endl;}
  }

int main() {
        double cda[3]={0,0,0};
          arrayPrint(cda, 3);

cin.sync(); getchar(); return 0;
}



Relevant Pages

  • Re: Warning on assigning a function-returning-a-pointer-to-arrays
    ... This declares pfunc as a function taking no arguments and returning ... int x, y; ... Presumably pfuncwill return a pointer to a single int, ... or the first of a sequence of "array 5 of int"s. ...
    (comp.lang.c)
  • Re: The question regarding type of pointers
    ... int day_of_year ... According to my understanding daytab is pointing to the whole daytab ... array i.e it is equivalent to p3. ... daytab is converted to a pointer to the first ...
    (comp.lang.c)
  • Re: How would you design Cs replacement?
    ... I would get rid of void. ... a member called size of type int. ... size of the array pointed at by v->dynamic is given by int size. ... If you pass an unsized pointer to a sized parameter, ...
    (comp.lang.c)
  • Re: Newbie
    ... to talk about the int value 3 and the int value 4, ... It also lets you talk about pointer ... C has a special rule for array objects. ... to printf() is: ...
    (comp.lang.c)
  • Re: socket communication: send & receive doesnt work right
    ... Maybe start from sending simple byte array to check what happen with byte ... I did a test of sending two doubles: ... public void send_doubles(double vals, int len) throws IOException ... char *result; ...
    (microsoft.public.win32.programmer.networks)