10-15-2008
The short answer - it is an undefined operation. Means that the C standard regards this as garbage, and your compiler was polite enough to produce spaces.
The reason: there are no sequence points in the line between important steps.
A ; character creates a sequence point. So the first version works. This means the compiler can do any of those calculations in any order...
By the way, that 'swap' algorithm in general is a bad idea; it has unsafe properties. You should use a temp variable. It may look cool to you, but that is about it.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i posted a reply the other day and needed an answer to this question while i was clarifyiing a few matter.. "how to compare to date variable in string format without having to compare word for word"..
my reply was to try to use awk to compare the strings.. I wasn't quite sure if i remembered how... (2 Replies)
Discussion started by: moxxx68
2 Replies
2. Programming
Hi !
How to reset a variable to 0 after a reset value, say 10 using bitwise
XOR.
For example,
int cnt=0;
if(cnt<10)
cnt++;
else
cnt = 0;
How can we achieve this by using XOR only.
thanks, (1 Reply)
Discussion started by: mrgubbala
1 Replies
3. Shell Programming and Scripting
i have to xor two variables in ksh. how to do that?
tia,
DN2 (5 Replies)
Discussion started by: DukeNuke2
5 Replies
4. Shell Programming and Scripting
Hi,
What is the difference in the following two awk one-liners?
awk -F, '{s++} END {if (s == 1 && $4 > "09:10:00") {print $2, $4}}' f1
awk -F, '{s++} s == 1 && $4 > "09:10:00" {print $2, $4}' f1
Even though, all the 2nd column values have duplicate records, the first code does not give any... (4 Replies)
Discussion started by: royalibrahim
4 Replies
5. Shell Programming and Scripting
Hi,
In the following perl code:
#!/usr/bin/perl -w
if (open(FILE, "< in_file")) {
while (<FILE>) {
chomp($_);
if ($_ =~ /patt$/) {
my $f = (split(" ", $_));
print "$f\n";
}
}
close FILE;
}
Why changing the "FILE" as... (4 Replies)
Discussion started by: royalibrahim
4 Replies
6. Programming
Hi,
In the below C code,
#include <stdio.h>
void print() {
printf("Hello\n");
}
int main() {
void (*f)() = (void (*)()) print;
f();
(*f)();
}
I wonder, how the syntaxes "f()" and "(*f)()" are treated as same without any error? Is this an improvement or ANSI/ISO... (1 Reply)
Discussion started by: royalibrahim
1 Replies
7. UNIX for Dummies Questions & Answers
I am aware of truth table for XOR between binary values .
Out of curious in would like to know how XOR works between 2 strings which contain alphabets .
For example A ^ B
How it works internally?
Please help me to understand this
Thanks (1 Reply)
Discussion started by: pandeesh
1 Replies
8. FAQ Submission Queue
The purpose of this article is revealing the unrevealed parts of the bitwise XOR.
As we aware, the truth table for the XOR operator is :
A B A^B
0 0 0
0 1 1
1 0 1
1 1 0
For example , 1^2 will be calculated as given below:
First the operands... (1 Reply)
Discussion started by: pandeesh
1 Replies
9. UNIX for Dummies Questions & Answers
hi,
i am new to shell programming, can u please tell me how to perform XOr operation of two strings.
i tried to do xor using ^symbol but this doesnt work.
help me with this
Thanks (12 Replies)
Discussion started by: anil_uvce
12 Replies
nan(3M) nan(3M)
NAME
nan(), nanf(), nanl(), nanw(), nanq() - string to NaN conversion functions
SYNOPSIS
HP Integrity Server Only
DESCRIPTION
The function creates a quiet NaN from the specified string. If tagp does not point to an n-char-sequence or an empty string, the call is
equivalent to
The ISO/IEC C99 standard specifies n-char-sequence syntax, but the interpretation and extension of the syntax is implementation defined.
The n-char-sequence argument is ignored on HP-UX systems.
Integrity Server Only
is a version of it returns a result.
is a version of it returns a result.
is an version of it returns an result.
is equivalent to on HP-UX systems.
USAGE
To use these functions, compile either with the default option or with the and options. To use compile with the option. Make sure your
program includes and link in the math library by specifying on the compiler or linker command line.
For more information, see the at:
RETURN VALUE
The function returns a quiet NaN.
These functions raise no exceptions.
ERRORS
No errors are defined.
SEE ALSO
copysign(3M), isnan(3M), nextafter(3M), math(5).
STANDARDS CONFORMANCE
: ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")
nan(3M)