473,320 Members | 1,857 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,320 software developers and data experts.

can u tell me the reason that y we get this types of outputs

program1 :1

main()
{
printf("trip" "trapas");
}

output:trip traps

prog 2:
main()
{
prinf(5+ "bangalore");
}
output:lore

prog: 3
main()
{
n=5;
printf("\n n=%*d",n,n);
}
output:5

Jan 26 '06 #1
12 1728

vinayakapuram schrieb:
program1 :1

main()
{
printf("trip" "trapas");
}

output:trip traps
I don't believe it.

prog 2:
main()
{
prinf(5+ "bangalore");
}
output:lore
I don't beleive this either. Yet, there should be some messages from
the compiler and the linker about 'prinf'
prog: 3
main()
{
n=5;
printf("\n n=%*d",n,n);
}
output:5


Why is it so hard to tell the truth? You are lieing 3 times in a row.

Jan 26 '06 #2
vinayakapuram wrote:
program1 :1

main()
{
printf("trip" "trapas");
} output:trip traps
"str1 " "str2" is often used to conctenate two constant strings
your code should print triptrapas without the space.
prog 2:
main()
{
prinf(5+ "bangalore");
}
output:lore because printf accepts a char* (pointer address) and you are giving an
offset of 5 to that address. prog: 3
main()
{
n=5;
printf("\n n=%*d",n,n);
}
output:5

printf accepts multiple parameters and ignores if a substitution is not
found ...

Apart from being very poorly written, you code was not compilable
without modifications. Please try to post compilable code.

Jan 26 '06 #3
(Note that there are no words "u" and "y" in the English language.)

vinayakapuram wrote:

program1 :1

main()
{
printf("trip" "trapas");
}

output:trip traps
More likely, "triptrapas", as the above is the same as:

printf("triptrapas");
prog 2:
main()
{
prinf(5+ "bangalore");
}
output:lore
Hint 0: What is the proper spelling of "printf"?
Hint 1: What is the value of the expression 5+"bangalore"
Hint 2: Addition is commutative.
prog: 3
main()
{
n=5;
printf("\n n=%*d",n,n);
}
output:5


Actually, the above is invalid, as you never declare "n". However,
assuming you really meant "int n=5;" ...

Because n is 5. What would you expect the output to be?

However, I suspect that the output is really a newline followed by
" n= 5"

--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>

Jan 26 '06 #4
vinayakapuram wrote:
program1 :1

main()
main *always* return an int.

int main(void)
{
printf("trip" "trapas");
The function printf does not have a prototype in scope.
You should include <stdio.h> in your program.
}

output:trip traps
What compiler are you using?
I recommend you switch to one that produces executables that execute as
expected.

I'd expect any executable produced by a decent compiler for your
source code above to output "triptrapas" (minus the quotes).
prog 2:

<snip>

--
If you're posting through Google read <http://cfaj.freeshell.org/google>
Jan 26 '06 #5
Ingo Menger wrote:
vinayakapuram schrieb:
program1 :1

main()
{
printf("trip" "trapas");
}

output:trip traps
I don't believe it.


Nor I.

prog 2:
main()
{
prinf(5+ "bangalore");
}
output:lore
I don't beleive this either. Yet, there should be some messages from
the compiler and the linker about 'prinf'


Assuming printf in place of prinf, this is normal.
prog: 3
main()
{
n=5;
printf("\n n=%*d",n,n);
}
output:5


Why is it so hard to tell the truth? You are lieing 3 times in a row.


He may have simply elided blanks.

However the OP seems unable to write English. His article is full
of meaningless things such as 'u' and 'y'. He seems to enjoy
making it as hard as possible for anyone to assist him. That is
also why he typed in the program snippets with typos, in place of
cut and paste.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Jan 26 '06 #6

CBFalconer schrieb:
Ingo Menger wrote:
vinayakapuram schrieb:
main()
{
n=5;
printf("\n n=%*d",n,n);
}
output:5
Why is it so hard to tell the truth? You are lieing 3 times in a row.


He may have simply elided blanks.


Maybe. But "n=" is still not blank.
That is
also why he typed in the program snippets with typos, in place of
cut and paste.


Maybe nobody has invented "cut and paste" yet in india.

Jan 26 '06 #7

Ingo Menger wrote:
Why is it so hard to tell the truth? You are lieing 3 times in a row. Maybe nobody has invented "cut and paste" yet in india.


You have not answered even a single question and given two useless
comments in the post so far - something you want to re-invent ?

Jan 26 '06 #8
Ingo Menger wrote:

CBFalconer schrieb:
Ingo Menger wrote:
vinayakapuram schrieb:
> main()
> {
> n=5;
> printf("\n n=%*d",n,n);
> }
> output:5

Why is it so hard to tell the truth? You are lieing 3 times in a row.
He may have simply elided blanks.


Maybe. But "n=" is still not blank.


Nor is n necessarily of type "int".
That is
also why he typed in the program snippets with typos, in place of
cut and paste.


Maybe nobody has invented "cut and paste" yet in india.


You didn't quote the previous sentences, which included:
However the OP seems unable to write English. and He seems to enjoy making it as hard as possible for anyone to assist him.


My guess is the "he didn't cut-and-paste" refers to the latter sentence.

--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>
Jan 26 '06 #9
Sandeep wrote:

vinayakapuram wrote:

[...]
prog: 3
main()
{
n=5;
printf("\n n=%*d",n,n);
}
output:5

printf accepts multiple parameters and ignores if a substitution is not
found ...


True, but irrelevent here, as the format string expects 2 ints. (Check
the meaning of "*".) So, if n happens to be of type "int" (there is no
definition of "n" here), the above is valid code, and both parameters
are used.

[...]

--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>

Jan 26 '06 #10
vinayakapuram <qw****@poiuyu.corg> writes:
program1 :1

main()
{
printf("trip" "trapas");
}

output:trip traps

prog 2:
main()
{
prinf(5+ "bangalore");
}
output:lore

prog: 3
main()
{
n=5;
printf("\n n=%*d",n,n);
}
output:5


You've gotten a lot of criticism for this post. Let me explain why.

You put the question in the Subject: header. Not all news reading
software displays the subject header in a convenient manner. You need
to put the question in the body of the message as well.

Silly abbreviations like "u" for "you" and "y" for "why" are frowned
upon here. They make your writing very difficult to read, especially
for those whose native language isn't English. Minor spelling and
grammatical errors are ok, especially if English isn't *your* native
language, but please take the time to spell out the words. Standard
punctuation and capitalization are also very helpful.

The code you posted is not the same as the code that you compiled.
The first one doesn't produce the same output you say it does, the
second one misspells "printf" as "prinf", and the third doesn't
declare "n". All of them are missing the required
"#include <stdio.h>", and all of them should declare main as
"int main(void)" and have a "return 0" at the end.

You need to copy-and-paste the *exact* code that you fed to the
compiler rather than re-typing it. If you want help, don't make us
guess which errors were in your original code and which were
introduced when you re-typed it.

It's all about taking just a little extra effort to make it easier for
us to help you.

As for your questions:

1. Adjacent string literals are concatenated by the compiler.

2. A string literal represents an array. In most contexts, it's
implicitly converted to a pointer. You then perform pointer
arithmetic on the result. See section 6 of the comp.lang.c FAQ,
at <http://c-faq.com/>. (See the rest of it, too.)

3. Read the documentation for the printf function.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jan 26 '06 #11
CBFalconer wrote:

[snip...] [snip...] [snip...]

However the OP seems unable to write English. His article is full
of meaningless things such as 'u' and 'y'. He seems to enjoy
making it as hard as possible for anyone to assist him. That is
also why he typed in the program snippets with typos, in place of
cut and paste.

y u wud think e wus st00pid or sum 10..... ;-)

I think it was Mark Twain who said: "There are *not* too many
stupid people, just an uneven distribution of lightning."

--
+----------------------------------------------------------------+
| Charles and Francis Richmond richmond at plano dot net |
+----------------------------------------------------------------+
Jan 27 '06 #12

Sandeep schrieb:
Ingo Menger wrote:
Why is it so hard to tell the truth? You are lieing 3 times in a row. Maybe nobody has invented "cut and paste" yet in india.


You have not answered even a single question


What question? The OP states "questions" of the form:

| Source: cflkasuhdpföasghnba.sfgbnöasfdkjh
| Output: kljydhlkjasdhgasldjkgfsd
| Please explain!

i.e., he asks us to comment on his lies. I did just that.
If you want honest answers, ask honest questions.

Moreover, every damn FAQ on this planet advises to ask that kind of
question in the form "I expected X, but it did Y", not just "explain".
Is it really too hard to show a minimum of gentle behaviour when one
needs help?

Jan 27 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eric Schultz | last post by:
Good afternoon... I'm new to struts so I hope I'm not asking an obvious question, but so far I haven't found my answer in any book, web site, or google search. I need to develop an application...
303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
3
by: Zeng Dinghao | last post by:
char c = 'd'; const char cc = 'd'; char* pc = "dfdfdf"; const char* pcc = "dfdfdf"; char const* cpc = "dfdf"; cout << typeid(c).name() << endl; cout << typeid(cc).name() << endl; cout <<...
6
by: auldh | last post by:
so far i have been able to understand how to use C# to read the regisry but getting to read the MULTI_SZ and REG_SZ just doesn't make sense. my sample program outputs the data as "System.String"...
5
by: chenedor | last post by:
Hi all I am a bit confuse about unboxing... what is the difference and what is best practice ? object o = __box(1234); int n = *dynamic_cast<__box int*>(o); of
8
by: ypjofficial | last post by:
Hi all, In what way does the enumerated data type contibute to the size of a class if its part of that class? eg. #include <iostream.h> class one { public:
58
by: jacob navia | last post by:
Hi people I have been working again in my tutorial, and I have finished the "types" chapter. If you feel like "jacob bashing" this is the occasion! I am asking for criticisms, or for things I may...
2
by: gdarian216 | last post by:
the program reads input from a file and then outputs the averages and grade. for some reason it is reading in the same line twice and it doesn't print out the grade. everything else is correct, if...
11
by: john | last post by:
Hi, at first the code doesn't seem to work. Any ideas?: #include <iostream> #include <cstdlib> int main() { using namespace std;
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: 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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.