i need an application that output a list of data to a text file. i have it set to save all of the data into arrays but it will not output the arrays to a .txt file. All i get is 0x22fed0 in the txt. How do i get it to output the entire array?
Out putting 2d arrays to text files
Collapse
X
-
Originally posted by dtimes6What u get is the address to the array. do iterate it using a for loop.
int Slab[50]
Slab[20] = 100;
Slab[20] will give the value 100 and it is an integer
I will let you work the rest out.
I must admit that this has the feel of an unstudied university assignment about it.
There are far to many unqualified programmers with university degrees ;)
Study hard.Comment
-
Originally posted by StarasorisWhat type of data is the array. char? int? The array variable itself is nothing bat a pointer to that specified type.
int Slab[50]
Slab[20] = 100;
Slab[20] will give the value 100 and it is an integer
I will let you work the rest out.
I must admit that this has the feel of an unstudied university assignment about it.
There are far to many unqualified programmers with university degrees ;)
Study hard.Comment
-
Originally posted by dtimes6array is not eq to pointer!
Code:int *pointer = new int[50]; int array[50]; /* This is all valid */ pointer[20] = 100; array[20] = 100; *(p+21) = 101; *(array+21) = 101; /* but */ if (sizeof pointer != sizeof array) // This is true { cout << "Size of pointer and array are different!" << endl; } /* and interestingly */ delete[] pointer; pointer = array; if (p == array) // This is true { cout << "p == array\n"; } if (&pointer != &array) // This is true but in fact wont compile in C++ // because &pointer and &array have different types { cout << "&p != &array\n"; }
Comment
Comment