i have a 2d array that's array[10][10] and a double number. I want to put that number into the 1st line of the array how will i do that?

array[0]=number; does not work, is there a simple way of converting it?

for instance

double number;
double list[10][10]
i want to make
list[0] = 5.35 basically filling the first line. Please help, thanks

Heres the code that i tried

#include <stdio.h>

int main ()
char word[10][10];
double num;
double number[10][10];

Recommended Answers

All 5 Replies

This thread might clear things up.

i'm still confused, the thread sets an array = to another array, what i want to do is set an array = to a (double) number

If what you mean is that you want to fill list[0][0] through list[0][9] with 5.35f, then use a for loop and assign 5.35f to each int from 0 through 9 on row 0.

You define the TWO 2D arrays, but then you handle them like 1D vectors. Is that what you want to do?

double number[10][10];

. . .


. . .

If you want to assign num to array element (0,0), you should state it like this:


thanks, i somehow got it fixed!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.