473,936 Members | 16,531 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Syntax issue

Hey I have a CODE that some 1 wrote however he use this line

x= (y=4,z=6);

( by the way the output of this line is x=6 , y=4 , z=6 )

i was wondring in what situation i will have to use it?
and does it good for?

Second thing Can some 1 explain me the way to use the MAX_RAND while
using rand() I dont understand what does the MAX_RAND do

10x in advance

Aug 24 '06 #1
12 1643
Chief wrote:
Hey I have a CODE that some 1 wrote however he use this line

x= (y=4,z=6);

( by the way the output of this line is x=6 , y=4 , z=6 )

i was wondring in what situation i will have to use it?
and does it good for?

Second thing Can some 1 explain me the way to use the MAX_RAND while
using rand() I dont understand what does the MAX_RAND do

10x in advance
dude 4 yr 1st ques its the comma ope8r dont have 2 use it if
u dont want 2 handy some timz anyway c book has all u need 2
no 4 sure 2nd ques no such animal hope this helps ciao babe

--
Eric Sosman
es*****@acm-dot-org.invalid
Aug 25 '06 #2

Eric Sosman wrote:
Chief wrote:
Hey I have a CODE that some 1 wrote however he use this line

x= (y=4,z=6);

( by the way the output of this line is x=6 , y=4 , z=6 )

i was wondring in what situation i will have to use it?
and does it good for?

Second thing Can some 1 explain me the way to use the MAX_RAND while
using rand() I dont understand what does the MAX_RAND do

10x in advance

dude 4 yr 1st ques its the comma ope8r dont have 2 use it if
u dont want 2 handy some timz anyway c book has all u need 2
no 4 sure 2nd ques no such animal hope this helps ciao babe
Medic! MEDIC! Even Eric's caught it now. Nobody's safe. Condoms on
fingers everyone.

Aug 25 '06 #3
Chief posted:
Hey I have a CODE

Culminary Orthogonal Device Ensembles are off-topic here.

x= (y=4,z=6);

( by the way the output of this line is x=6 , y=4 , z=6 )

In C++, maybe. In C, assignment to a variable cannot result in output.

i was wondring in what situation i will have to use it?

<OFF-TOPIC>

When CODE's enter Relax Mode, they tend to over-iterate through arrays --
the only way to normalise the indexing is by using the comma operator in
conjuction with multiple assignments.

</OFF-TOPIC>

and does it good for?

It works quite well (on modern CPU's). Don't try it on a 486.

Second thing Can some 1 explain me the way to use the MAX_RAND while
using rand() I dont understand what does the MAX_RAND do

Yes, indeed:

int max = (MAX_RAND, rand());

(See how I have normalised the over-iteration by using the comma operator
in conjunction with mutiple assignments?)

10x in advance

Whoa whoa whoa, don't get ahead of yourself! If the algorithm which
initialises the CODE is run ten times in advance, the over-iteration will
be far too erratic to correct. Any attempt to normalise the indexing at
that point will result in hard-disk over-burn -- so let's hope you keep
everything backed up.

--

Frederick Gotham
Aug 25 '06 #4
On Fri, 25 Aug 2006 01:41:15 GMT, Frederick Gotham
<fg*******@SPAM .comwrote:
>Chief posted:
>Hey I have a CODE


Culminary Orthogonal Device Ensembles are off-topic here.

>x= (y=4,z=6);

( by the way the output of this line is x=6 , y=4 , z=6 )


In C++, maybe. In C, assignment to a variable cannot result in output.
If that were true, then code of the form
if ((ptr = malloc(10)) == NULL)
could never work.

The result of evaluating the assignment operator is the value that is
assigned to the left operand. The statement evaluates as
assign 4 to y
discard result
assign 6 to z
assign result (in this case 6) to x

Remove del for email
Aug 25 '06 #5
Eric Sosman wrote:
Chief wrote:
Hey I have a CODE that some 1 wrote however he use this line

x= (y=4,z=6);

( by the way the output of this line is x=6 , y=4 , z=6 )

i was wondring in what situation i will have to use it?
and does it good for?

Second thing Can some 1 explain me the way to use the MAX_RAND while
using rand() I dont understand what does the MAX_RAND do

10x in advance

dude 4 yr 1st ques its the comma ope8r dont have 2 use it if
u dont want 2 handy some timz anyway c book has all u need 2
no 4 sure 2nd ques no such animal hope this helps ciao babe
This gets bookmarked ;-)

Aug 25 '06 #6
Barry Schwarz wrote:
On Fri, 25 Aug 2006 01:41:15 GMT, Frederick Gotham
<fg*******@SPAM .comwrote:
Chief posted:
Hey I have a CODE

Culminary Orthogonal Device Ensembles are off-topic here.

x= (y=4,z=6);

( by the way the output of this line is x=6 , y=4 , z=6 )

In C++, maybe. In C, assignment to a variable cannot result in output.

If that were true, then code of the form
if ((ptr = malloc(10)) == NULL)
could never work.

The result of evaluating the assignment operator is the value that is
assigned to the left operand. The statement evaluates as
assign 4 to y
discard result
assign 6 to z
assign result (in this case 6) to x
What Mr Gotham said was that variable assignment cannot result in
*output*, in reply to the OP's statement that the assignment resulted
in a line of output.

Robert Gamble

Aug 25 '06 #7
Barry Schwarz posted:
>>In C++, maybe. In C, assignment to a variable cannot result in output.

If that were true, then code of the form
if ((ptr = malloc(10)) == NULL)
could never work.

You're correct. I meant to say I was referring to assignments involving
simple object names:

a = b;

In C++, this could result in output (depending on whether there's a user-
defined assignment operator for the type "a" is).

In C, it can't do anything more than change the value of "a".

--

Frederick Gotham
Aug 25 '06 #8
Frederick Gotham wrote:
Barry Schwarz posted:
>In C++, maybe. In C, assignment to a variable cannot result in output.
If that were true, then code of the form
if ((ptr = malloc(10)) == NULL)
could never work.


You're correct. I meant to say I was referring to assignments involving
simple object names:

a = b;

In C++, this could result in output (depending on whether there's a user-
defined assignment operator for the type "a" is).

In C, it can't do anything more than change the value of "a".
No legal assignment can result in the printing of output, not just
those involving simple object names.

Robert Gamble

Aug 25 '06 #9
Robert Gamble posted:
No legal assignment can result in the printing of output, not just
those involving simple object names.

#include <stdio.h>

int main(void)
{
int a,b,c,d,e,f,g;

a = puts("Hello!");
b = puts("Hello!");
c = puts("Hello!");
d = puts("Hello!");
e = puts("Hello!");
f = puts("Hello!");
g = puts("Hello!");

return 0;
}

--

Frederick Gotham
Aug 25 '06 #10

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

Similar topics

699
34894
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
303
18163
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. Yahoo store was originally written in Lisp. c. Emacs The issues with these will probably come up, so I might as well mention them myself (which will also make this a more balanced
22
3454
by: Tuang | last post by:
I'm checking out Python as a candidate for replacing Perl as my "Swiss Army knife" tool. The longer I can remember the syntax for performing a task, the more likely I am to use it on the spot if the need arises. If I have to go off and look it up, as I increasingly have to do with Perl's ever hairier syntax, I'm more likely to just skip it, making me even less likely to remember the syntax the next time. So I hear that Python is easier...
75
3946
by: David MacQuigg | last post by:
Seems like we need a simple way to extend Python syntax that doesn't break existing syntax or clash with any other syntax in Python, is easy to type, easy to read, and is clearly distinct from the "base" syntax. Seems like we could put the @ symbol to good use in these situations. Examples: print @(separator = None) x, y, z @x,y:x*x+y*y -- anonymous function
5
2746
by: Drifter | last post by:
The quote below is part of the information i want to save to a MS Access database - or update, as the case may be. The original database was built a long time ago, and looking at the code for add/update on the original site-it does not compensate for odd syntax like the quotes. Problem i am hitting now is syntax issue in the SQL when I go to save/update. The syntax present causes failures every time. User said she had no problems...
19
2991
by: Nicolas Fleury | last post by:
Hi everyone, I would to know what do you think of this PEP. Any comment welcomed (even about English mistakes). PEP: XXX Title: Specialization Syntax Version: $Revision: 1.10 $ Last-Modified: $Date: 2003/09/22 04:51:49 $ Author: Nicolas Fleury <nidoizo at gmail.com> Status: Draft Type: Standards Track
8
3334
by: BobTheDatabaseBoy | last post by:
the following syntax is accepted: alter table DB2ADMIN.APPTS add constraint appts_status check (lob_appt_status in ( case when state_code = 'VA' then 'P' -- , 'I' else 'X'
15
2301
by: computerider | last post by:
I have this code which works fine and will open the form to the correct record but it produces a "Type mismatch" msgbox on opening the record... the stLinkCriteria consists of two values one of which is a number - is the syntax causing this? ******************************************************************************************** Private Sub Command13_Click() On Error GoTo Err_Command13_Click Dim stDocName As String
3
4615
by: BD | last post by:
Hi, folks. Sorry about this - I have been R'ing all TFM's I can find, but am just getting more frustrated. Background: db2 UDB 8.1 on Windows. I'm quite new to db2, but have several years Oracle experience.
7
11609
by: sumanta123 | last post by:
Dear Sir when i am getting the value from properties file the the path showing http://127.0.0.1:81/help/Subject of Issue.txt which is right. But in jsp in try block when pass SubjectofIssue path that time it is showing SubjectofIssue););//http:\127.0.0.1:81\help\Subject of Issue.txt So the error comming in jsp page. Please look at my error log.
0
10123
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9955
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10641
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9845
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7367
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6061
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6268
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4435
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.