473,327 Members | 2,112 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,327 software developers and data experts.

WHY output is like that

# include <stdio.h>
# include <conio.h>
main()
{
unsigned i=1;
signed j=-1;
clrscr();
if(i<j)
printf("small");
else if(i>j)
printf("greater\n");
else
printf("Equal");

getch();
}




output is small
pls explain me why?
Mar 21 '07 #1
2 1116
horace1
1,510 Expert 1GB
you are comparing signed and unsigned operands and, using the usual arithmetic conversions, the signed value is converted to a large unsigned value, see 710 in
http://c0x.coding-guidelines.com/6.3.1.8.html
Mar 21 '07 #2
dmjpro
2,476 2GB
a new thing i come to know ......

but it would be better if u r more clear ...... i mean how the default conversion happens in C or C++ ... as in java this is very obvious , so it is called strongly typed langauge


thanx ...
Mar 21 '07 #3

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

Similar topics

0
by: Jerry | last post by:
Hi All, I'm using the wonderful CURL lib to handle data between php-scripts in the background. However, I am experiencing a problem: Whenever the processed data is returned for output I see a...
4
by: Mark Wilson CPU | last post by:
This must be easy, but I'm missing something... I want to execute a Perl script, and capture ALL its output into a PHP variable. Here are my 2 files: -------------------------------------...
2
by: Jesper Moth | last post by:
The MSXML4 xslt-parser would output any source <div/> like this: <div></div> I never figured out how to disable this behaviour. But since it makes the source document look cleaner, and since...
1
by: Wolfgang | last post by:
XSLT transformations by default seem to pass name space attributes into the root element of their output (example below). QUESTION: Is it possible to control this, i.e. not genrating a name...
3
by: Liren Zhao | last post by:
I use some "Console.WriteLine(some strings here)" to display some debug information in my winform program. How can I get the information in my programe or same them in a text file ?
2
by: Buddy Ackerman | last post by:
Apparently .NET strips these white space characters (MSXML doesn't) regardless of what the output method is set to. I'm using <xsl:text> </xsl:text> to output a tab character and...
1
by: galivio | last post by:
I need a code in C where accepts inputs coming from an external text file and will give an output stored on another text file. For example, a C program to compute the sum of the two integers. The...
8
by: ehcy | last post by:
hello! i have a problem here will you please help me?.. this is my script <?php //$text = "Like '%american journal of med%'"; $text = $_POST; $sep = " ";
7
by: wongjoekmeu | last post by:
Dear all, I was wondering how in C++ the code would look like if I want to write the binary notation of a unsigned char to standard output or any other basic data type, like int, unsigned int,...
87
by: pereges | last post by:
I have a C program which I created on Windows machine. I have compiled and executed the program on windows machine and it gives me the consistent output every time i run it. for eg. input a = 2,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.