i had doubt regrdng this progrm... pls explain..
#include<stdio.h>
void main()
{
int a, b;
printf("enter d value fof a and b");
scanf("%d%d", &a, &b); printf("%d%d",&b,b);
}
wats d op of this program... pls get soon..
9 1265
You wrote 'void main()' which results in undefined behaviour.
kind regards,
Jos
You wrote 'void main()' which results in undefined behaviour.
Also he forgot code tags, that is by an order of magnitude larger sin.
And let alone printf("%d%d",&b,b) where &b is printing b's address ( if pointer and int are both 32 bit).
}
This format string is incompatible with the arguments: %d is for printing an int; &b is a pointer, b is an int.
Why would you want to print two numbers without any space between them?
Also he forgot code tags, that is by an order of magnitude larger sin.
And let alone printf("%d%d",&b,b) where &b is printing b's address ( if pointer and int are both 32 bit).
The OP also didn't write his/her post in English; as a non-native speaker I had to
guess for the meaning of 'wats d op of this program... pls get soon..'.
My crappy-post-o-meter is rising ;-)
kind regards,
Jos
I have deleted the OP's other identical thread.
kind regards,
Jos
You wrote 'void main()' which results in undefined behaviour.
kind regards,
Jos
sir ,
actually i want to print memory adress of b & value of b
This format string is incompatible with the arguments: %d is for printing an int; &b is a pointer, b is an int.
Why would you want to print two numbers without any space between them?
actually i wanted print both address and value of b ,
If you want to see what it outputs, I recommend compiling and running this code. For the code itself, I recommend printing the address in hexadecimal and add some whitespace in between the two numbers so you can tell them apart.
actually i wanted print both address and value of b ,
"%p" is preferred for printing the address of a variable.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Mike |
last post by:
I am sure that I am making a simple boneheaded mistake and I would
appreciate your help in spotting in. I have just installed
apache_2.0.53-win32-x86-no_ssl.exe
php-5.0.3-Win32.zip...
|
by: edgrsprj |
last post by:
PROPOSED EARTHQUAKE FORECASTING
COMPUTER PROGRAM DEVELOPMENT EFFORT
Posted July 11, 2005
My main earthquake forecasting Web page is:
http://www.freewebz.com/eq-forecasting/Data.html
...
|
by: Tom Lee |
last post by:
Hi,
I'm new to .NET 2003 compiler. When I tried to compile my
program using DEBUG mode, I got the following errors in the
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
\include\xdebug...
|
by: christopher diggins |
last post by:
I am wondering if any can point me to any open-source library with program
objects for C++ like there is in Java? I would like to be able to write
things like
MyProgram1 >> MyProgram2 >>...
|
by: Eric Whittaker |
last post by:
hi all,
im trying to write my first c++ program. a success, but i can't get the
window to stay open after user enters input. it just automatically closes.
right now the end of my program looks...
|
by: Hemal |
last post by:
Hi All,
I need to know the memory required by a c program. Is there any
tool/utility which can give me the memory usage in terms of DATA
segment, TEXT segment, BSS segment etc.
I am working...
|
by: ibtc209 |
last post by:
I just started programming in C, and I need some help with this problem.
Your program will read the information about one MiniPoker hand, namely the rank and suit of the hand’s
first card, and...
|
by: Banfa |
last post by:
Posted by Banfa
The previous tutorial discussed what programming is, what we are trying to achieve, the answer being a list of instructions constituting a valid program. Now we will discuss how...
|
by: amitpatel66 |
last post by:
There is always a requirement that in Oracle Applications, the Concurrent Program need to be execute programatically based on certain conditions/validations:
Concurrent programs can be executed...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
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,...
| |