Sponsored Content
Full Discussion: ternary operator
Top Forums Programming ternary operator Post 302114019 by manoj.rana on Thursday 12th of April 2007 03:58:01 AM
Old 04-12-2007
ternary operator

fn_max(var_type a,var_type b,var_type c)
{
var_type t;
return(t=((t>a?:t;a)>b)?:t;b)>c?:t;c)
}

break the above expresiion as follows.
1. (t>a?:t;a)
2. ((result)>b)?:t;b)
3. result>c?:t;c
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

And operator

I am trying to check two variables and if both are blank I want to set a flag: the_f3_pid=`rsh $target ps -ef | grep "f3.eab" | awk '{print $2}'` the_f7_pid=`rsh $target ps -ef | grep "f7.eab" | awk '{print $2}'` if ; then y=1 fi I get an error: ./script_name: test: 0403-021 ]... (4 Replies)
Discussion started by: rcarnesiii
4 Replies

2. HP-UX

Or operator with if

hi, i was trying to club to test condition with if. if -o ; then it is giving me error message, i wanted to ask how can we check two condtions with one if. (1 Reply)
Discussion started by: babom
1 Replies

3. Programming

new operator

Hi, Please clear the 2 questions, 2 Questions, 1) Why the new as a operator? Is there any special reason why it can't be a function like malloc? 2) How are we considering sizeof(),new are as a opearartors? I know + - * / -> , . etc.. are operators, which criteria satisfied by sizeof()... (4 Replies)
Discussion started by: Nagapandi
4 Replies

4. Shell Programming and Scripting

zsh ternary operator syntax help

Hi, Can someone give me an example of how to use zsh's ternary operator? I tried: # a=1 # c=( a ? "true" : "false" ) and got: zsh: no matches found: ? I'm running zsh 4.2 on RHEL AS 4. Thanks! Paul (1 Reply)
Discussion started by: paul99
1 Replies

5. UNIX for Dummies Questions & Answers

su with << operator

All, THe below is my script , when i use this i am getting nothing . could any one help me to know what is the use of the << operator below su - $8 << supo echo "exportsph $2 $1 $3 $4" exportsph $2 $1 $3 $4 supo i also tried as individual command su - userid << supo , when i do... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies

6. Shell Programming and Scripting

equal to operator

Hi, I have the below script executed arg="dir" if "$arg" = "dir" then echo "true" else echo "false" fi Please let me know what happens in the if command. My output is: dir: dir: No such file or directory false which is not the desired output. When i used test command... (1 Reply)
Discussion started by: anijan
1 Replies

7. Programming

C++ no match for 'operator []'

I wrote a little students management program using structs, and when I try to compile it, an error appears: luke@luke-desktop:~/Desktop/ProgII$ g++ recStudents.cc recStudents.cc: In function ‘void add(TList&, Tstudent)': recStudents.cc:114: error: no match for ‘operator' in ‘Slist'Here... (2 Replies)
Discussion started by: Luke Bonham
2 Replies

8. UNIX for Dummies Questions & Answers

+= operator

im new to bash scripting and im just using online tutorials and trial and error. i wanted to write a script to read numbers from a file and find their sum: #!/bin/bash theSum=0 for line in $(cat numbers.txt) do let "theSum = theSum + $line" echo "$line" done echo "The sum is... (3 Replies)
Discussion started by: astrolux444
3 Replies

9. Shell Programming and Scripting

sed or operator

hi, I got a requirement to change existing script like below to search additional pattern "DB select". i tried using \| opearator but it is not working :(. Below is the existing code echo $(cat ${1} |sed -n '/Error in/ { N N N /Too many/ { p ... (5 Replies)
Discussion started by: shyamxtasy
5 Replies

10. Shell Programming and Scripting

Getting syntax error with awk ternary operator

split($7,a," "); date = a; time = a split(date,d,"/"); month = sprintf("%02d",d); day = sprintf("%02d",d); year = 2000 + d % 100 split(time,t,":"); hour=t; min=t hour >= 12? { hour=hour-12; amPm=" PM" } : amPM=" AM" hour == 0? hour=12 time=sprintf("%02d",hour)":"sprintf("%02d",min)amPm ... (4 Replies)
Discussion started by: Michael Stora
4 Replies
brk(2)								System Calls Manual							    brk(2)

NAME
brk, sbrk - change data segment space allocation SYNOPSIS
DESCRIPTION
and are used to change dynamically the amount of space allocated for the calling process's data segment; see exec(2). The change is made by resetting the process's break value and allocating the appropriate amount of space. The break value is the address of the first loca- tion beyond the end of the data segment. The amount of allocated space increases as the break value increases. The newly allocated space is set to zero. sets the break value to endds and changes the allocated space accordingly. adds incr bytes to the break value and changes the allocated space accordingly. incr can be negative, in which case the amount of allo- cated space is decreased. ERRORS
and fail without making any change in the allocated space if one or more of the following are true: [ENOMEM] Such a change would result in more space being allocated than is allowed by a system-imposed maximum (see ulimit(2)). [ENOMEM] Such a change would cause a conflict between addresses in the data segment and any attached shared memory segment (see shmop(2)). [ENOMEM] Such a change would be impossible as there is insufficient swap space available. [EINVAL] Such a change will result in crossing the boundary to uninitialized data in the calling process's data segment. WARNINGS
The pointer returned by is not necessarily word-aligned. Loading or storing words through this pointer could cause word alignment prob- lems. Be very careful when using either or in conjunction with calls to the malloc(3C) library routines. There is only one program data segment from which all three of these routines allocate and deallocate program data memory. RETURN VALUE
Upon successful completion, returns a value of 0. Otherwise, a value of -1 is returned and is set to indicate the error. Upon successful completion, returns the old break value. Otherwise, is returned and is set to indicate the error. The symbol is defined in the header No successful return from will return the value AUTHOR
and were developed by AT&T and HP. SEE ALSO
exec(2), shmop(2), ulimit(2), end(3C), malloc(3C). STANDARDS CONFORMANCE
brk(2)
All times are GMT -4. The time now is 08:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy