944,008 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Marked Solved
  • Views: 2177
  • C RSS
Dec 12th, 2008
0

How to type logical or

Expand Post »
Where do I locate the logical or on my keyboard? Thanks for your help in advance.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
GrahamShaw2008 is offline Offline
3 posts
since Nov 2008
Dec 12th, 2008
1

Re: How to type logical or

If you don't mean the logical OR operator in C, example follows, then you need to be more specific about what exactly you want to do.
  1. #include <stdio.h>
  2.  
  3. int main ( void )
  4. {
  5. if ( 0 || 1 ) /* || is the logical OR operator */
  6. puts ( "True" );
  7. else
  8. puts ( "False" );
  9.  
  10. return 0;
  11. }
Last edited by Narue; Dec 12th, 2008 at 9:24 am.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Dec 12th, 2008
0

Re: How to type logical or

Hi,

How do i type (||). In this case I used copy and paste. I cant find it on my keyboard.

Thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
GrahamShaw2008 is offline Offline
3 posts
since Nov 2008
Dec 12th, 2008
0

Re: How to type logical or

It's above the Enter key on your keyboard with '\' symbol.....................
Reputation Points: 5
Solved Threads: 3
Newbie Poster
gautam610 is offline Offline
13 posts
since Jul 2008
Dec 12th, 2008
1

Re: How to type logical or

>I cant find it on my keyboard.
Oh dear. It's the vertical bar, placed as the shift value for my backslash key, but it could be somewhere else (or not present at all) depending on the keyboard. Note that the || operator is two vertical bars, not a single key on your keyboard. If you still can't find it, you may fall into the category of C programmers that need to take advantage of C's trigraph sequences:
  1. #include <stdio.h>
  2.  
  3. int main ( void )
  4. {
  5. if ( 0 ??!??! 1 )
  6. puts ( "True" );
  7. else
  8. puts ( "False" );
  9.  
  10. return 0;
  11. }
This does the same thing as my first example, except the ??! trigraph represents the vertical bar with a combination of universal characters. Here are all of the trigraphs if you discover you're missing other keys:
  1. ??> }
  2. ??< {
  3. ??) ]
  4. ??( [
  5. ??= #
  6. ??! |
  7. ??/ \
  8. ??' ^
  9. ??- ~
  10.  
Before you use them, make absolutely sure that they're necessary, as trigraphs are clearly very detrimental to the readability of your code.
Last edited by Narue; Dec 12th, 2008 at 10:47 am.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Dec 12th, 2008
0

Re: How to type logical or

Thanks, so simple. My keyboard displays ¦, however prints correct |.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
GrahamShaw2008 is offline Offline
3 posts
since Nov 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Read Hardware Information
Next Thread in C Forum Timeline: Problem with Printf





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC