473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Why the garbage value is same for all variables?

please see the following code...

why the garbage value for all the variables is same for same data type?


Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. int main()
  3. {
  4.   int a,b,c;
  5.   float f1,f2;
  6.  
  7.  
  8.   printf("a=%d\nb=%d\nc=%d\nf1=%f\nf2=%f\n",a,b,c,f1,f2);
  9.  
  10. return 0;
  11. }
o/p:-

a=-858993460
b=-858993460
c=-858993460
f1=-107374176.000000
f2=-107374176.000000
Apr 22 '13 #1
2 1817
johny10151981
1,059 1GB
this is your debug mode value, go to release mode it will be changed to something else
Apr 22 '13 #2
weaknessforcats
9,208 Expert Mod 8TB
In the case of Visual Studio, the same garbage value is used for all variables. This is how the debugger can tell you that a variable you are using has not been initialized.

Other compilers don't do this and it is not required that they do.
Apr 22 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: arunvnk | last post by:
int main() { product g; product t; fstream k; k.open("stock.txt",ios::app|ios::in); int op=0; static int count=0; //k.open("stock.txt",ios::app,ios::in); while(op<4)
2
by: andrew browning | last post by:
this program is a binary tree using nodes. it should do an in-order print, which it does. however, it inserts a garbage value at the end of the print. ex: cin >> 1 2 3 4 5 prints 1 2 3 4 5...
17
by: minlar | last post by:
Hello,everyone: what the value of the variables in the next programe: { int x=35; char str; strcpy(str,"www.google.com");} what's the value of x and strlen(str)? any help is welcome, and I am...
1
by: lokesh yadav | last post by:
hi i need explanation why stack contains garbage while we refer to stack default is any method to clean the stack my program exit so that my stack should contain zero as default...
21
by: vlsidesign | last post by:
This syntax does not to work nl, nt, ns = 0; The only one that get's initialized is ns. nl and nt because they don't initialize seem to get some junk from memory. I have done these two...
8
by: Aftabpasha | last post by:
I have seen a simple program for handling Link List operations. The following is the part of the code that contains the problem. The code is modified but contains all necessary information regarding...
1
by: MANISH AGRAWAL | last post by:
/*programming for partition the elements of the array so that all the even numbers move to one side and odd numbers to the other side of the array.*/ #include<stdio.h> int main() { int...
1
by: imam waqas | last post by:
#include "stdafx.h" #include <iostream> #include <fstream> using namespace std; const char fileName = "c:\\Users\\user\\Desktop\\lab4prac\\data.txt"; void openfile(ofstream& outstream);...
3
by: Anchal Laller | last post by:
wht is garbage value?? how it generates and why it generates?? why default value is not null in c/c++
1
by: rinu budhbhatti | last post by:
i m working on csv file for the followin format. 07,30,45,pm 08,30,56,pm .... while fetching first column i get followin 07 ^ 08 * n some weird symbols..
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.