Quantcast
Channel: Tips for golfing in C - Code Golf Stack Exchange
Viewing all articles
Browse latest Browse all 67

Answer by es1024 for Tips for golfing in C

$
0
0
  1. Use *a instead of a[0] for accessing the first element of an array.

  2. Relational operators (!=, >, etc.) give 0 or 1. Use this with arithmetic operators to give different offsets depending on whether the condition is true or false: a[1+2*(i<3)] would access a[1] if i >= 3 and a[3] otherwise.


Viewing all articles
Browse latest Browse all 67

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>