Questions tagged [initializing]
115 questions
-2
votes
1 answer
chaining classe in CPP
The major problem I find at the moment is with "initializing pointers" .
In Pascal, all you had to do is declare NEW(POINTER). In C++, I am lost as - correct me if i am wrong - you have to declare a "dummy" variable in order to initiate a…

Chaim Chait
- 11
-2
votes
2 answers
C# jagged array not initializing
Trying to make a 2D jagged array that has 10 columns and 10 rows. When I try to initialize the first column, it comes up with multiple errors and i'm not sure what i'm doing wrong.
class Program
{
int[][] board = new int[10][];
board[0] =…

Jbchmbrs
- 3
- 1
-2
votes
2 answers
Initializing variables before for loops to use in for loops queston
I'm trying to get familiarized with for loops right now for school and and learning the syntax right now. I have a couple questions. If I am going to initialize variables in the loop how can I ask the user for them to input the variable values…

jp89lawson
- 17
- 6
-2
votes
1 answer
AngularJs - Pass initial object to a directive
I created a directive that should display a list of countries when it loads.
It should "remember" the selected country when he user gets to the page again (after navigating inside the SPA).
I am saving the selected country in a service, and when the…

RoiTr
- 136
- 11
-3
votes
1 answer
error C2440: 'initializing' : cannot convert from 'std::string' to 'double *[]'
I've been working on Microsoft Visual C++ 2010(32-bit system)
In the compilation phase i get an error that says:
1>------ Build started: Project: pruebavecot, Configuration: Debug Win32 ------
1> …

Andres Girón Cruz
- 3
- 1
- 4
-3
votes
2 answers
Variable isn't initialized when trying to use methods
calculateArea(Length, Height, Width);
double area;
calculateCost(area);
}
public static double calculateArea(int l, int h, int w) {
//Variables
double area;
//Length = l;
// Height = h;
//Width = w;
//Find the…

tfulk
- 1
- 1
-3
votes
3 answers
How to solve variable might not have been initialized error
I started studying for an exam and doing some practice programs with methods, and my mind is coming to a blank currently. I would like to know how I can initialize n1, n2, n3, and n4. I set them to 0 but the return statement returned only 0s.
public…

Alex McMahon
- 3
- 2
-5
votes
4 answers
C/C++ : Why is it impossible to declare a pointer in loop initialization
When printing an array, initializing an integer works.
int a[MAX_SIZE] = {1,2,3,4,5,6,7,8,9,10};
for (int i = 0; i <= (MAX_SIZE - 1); i++)
{
printf("%3d",a[i]);
}
However, I wonder why initializing a pointer to an integer ("walker") won't…

mintbox
- 167
- 1
- 2
- 14
-6
votes
1 answer
Allow user to name a class object
So, I ran into this problem while trying to create a text based game to play at work. :P
I wanted users to be able to make their new character, and the character object would be named, whatever they input. I know that I can just have a string…

Bobin
- 1
-7
votes
1 answer
what will be the uninitialized values of an array in C++?
When I tried to find the behavior of increment operators I got this result which I ended up wit two questions.
Here is the code and output.
#include
using namespace std;
int main(){
int arr[4] ;
int x =0;
cout << arr[0]…

captain_999
- 45
- 1
- 1
- 10