What is the easiest way to truncate an IP address to /24 in C? <p>Is there a method that can truncate the IP address to /24? Or, should I parse the IP address manually and do the conversion? </p> <p>Edit:</p> <p>Ip address is IPv4 and is stored in the Dotted decimal format surrounded by quotes as <code>char *</code>. I am expecting the /24 to be <code>char *</code> too. </p> <p>Example format: <strong>"64.233.174.94"</strong> . </p> <p>/24 expected format: <strong>"64.233.174.0"</strong></p> <p>Hope this helps. Thanks.</p>