Linked Questions

12 votes
4 answers
5k views

Why does this print 32767 (or some other random number)? What is std::cout printing? Why is it not NULL (or 0)? int main() { int a; std::cout << a; }
Joseph Nields's user avatar
3 votes
7 answers
2k views

I'm playing with c++ in VisualStudio2010 Please explain why IT happens: int a, b; int *p, *q; cout << a << " " << b; prints out "0 0". Well it's understandable, uninitialized ...
Viller's user avatar
  • 530
0 votes
5 answers
3k views

From "C++ Primer" by Lippman, When we define a variable, we should give it an initial value unless we are certain that the initial value will be overwritten before the variable is used for ...
dexter's user avatar
  • 195
-3 votes
2 answers
11k views

It might be a boring question! thanks! Here's the code: #include <iostream> #include <cstring> using namespace std; int main() { int a[5] = {0}; int b[5]; cout &...
HIPPO LD's user avatar
  • 509
5 votes
2 answers
5k views

#include <iostream> #include <string> using namespace std; int count_number_place(int number) { int number_placement; while (number >= 1) { number_placement++; ...
user3526002's user avatar
2 votes
3 answers
3k views

int main() { int a; cout << a; return 0; } I am wondering why the value 0 is being output. I thought if a variable is uninitialized, it would output a garbage value. However, I ...
csguy's user avatar
  • 1,504
2 votes
4 answers
3k views

I was trying to solve Hourglass problem in C++ on HackerRank. The task is following: Given a 6x6 2D Array, A: 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 We define an ...
Nasantogtokh Amarsaikhan's user avatar
0 votes
1 answer
581 views

My teacher told me that he is studying about compiler and he found out that garbage value in c++ can be expected or calculated with a formula like this = Range of that datatype - size of datatype = ...
Arjun Ghimire's user avatar
0 votes
3 answers
327 views

For some reason, the value of final_sum is 16 but I didn't initialize a value for that variable, why's that? Isn't supposed to start with 0? #include <iostream> #include <iomanip> #include ...
soup's user avatar
  • 101
0 votes
3 answers
455 views

If I don't initialize a C++ variable, I find that it automatically gives it 0 on some android phones, but not on others, and zero on all IOS phones. So what determines whether you give it 0, is it the ...
AndLightLight's user avatar
0 votes
1 answer
620 views

I'm a newbie in the programming world, and i've decided to start with C++ code a few days ago as my first programming language. I just started to read an online course which i'm guiding on (and aply ...
Alberu's user avatar
  • 1
0 votes
2 answers
509 views

In C++, having primitive type (int, double, char, ...) not-defined so undefined behaviour. There is no default value for primitive types, because they have no constructor. But the compiler is ...
milanHrabos's user avatar
  • 2,017
0 votes
1 answer
431 views

#include <iostream> int main() { int* pt; std::cout << pt << std::endl; if(pt) std::cout << "true" << std::endl; else std::cout << "...
Jack Wilkinson's user avatar
0 votes
1 answer
198 views

I'm trying to compare two class objects, which has both been initialized with 0.0, but for some reason C++ decides to convert the 0.0 to some extremly small value instead of keeping the 0.0, which ...
Exchange_programming's user avatar
0 votes
2 answers
610 views

I finally completed my code and when I submit it I received a couple errors. It keeps telling me 73:15 Incorrect spacing around >=. 73:31 Incorrect spacing around <=. for this line, I've ...
raelyn's user avatar
  • 17

15 30 50 per page
1
2 3 4 5 6