I wanted to discuss a situation where we need to set more than two bits in a 8-bit or 16-bit or 32-bit register and explore a suitable logic

By using below approach, we can set multiple bits in a 8 -bit register

Code:
 #include<stdio.h>

void set_Bits ( char num, char set_mask)
{
	num = num | set_mask;           // 00000010 OR 00000101 = 0000 0111 = 7
	
	printf("num : %d \n", num);     // Print value 7
	
}


int main()
{
	unsigned char num = 2; // binary 0000 0010  [MSB7 -LSB0] 
	unsigned char set_mask; 
	set_mask  = (1 << 0)| (1 << 2);  // 00000001 OR 00000100 = 00000101
    printf("mask value %d \n", set_mask);
	set_Bits( num, set_mask );
	return 0;
}
This logic is adaptable to different situations like 16 bit or 32 bit

but its matter of suitable suggest good way How to set 16 bits in 32 bit register

Please let me know your thoughts on this proposed logic, if you want to offer any efficent logic