I want to calculate the broadcast address for:
IP: 192.168.3.1 Subnet: 255.255.255.0 = 192.168.3.255
in C.
I know the way
Could it be?
unsigned broadcast(unsigned ip,unsigned subnet){ unsigned int bits = subnet ^ 0xffffffff; unsigned int bcast = ip | bits; return bcast; }
Edit: I considered that both ip and subnet are without "."