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

Answer by ceilingcat for Tips for golfing in C

$
0
0

Set an array of int to the same value (C99, Linux, BSD, OSX)

Instead of

int a[n]=...,x=...;for(int i=n;i--;)a[i]=x

Try something like

int a[n]=...,x=...;wmemset(a,x,n);

On MSVC on Windows, wmemset() works on arrays of short instead of int.


Viewing all articles
Browse latest Browse all 67

Trending Articles



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