help with some c home work
Any help from anyone would be awesome.
#1: In C, please write code to determine the longest consecutive bit string (1 or 0) in an array of bytes.
char string[] = { 0xff, 0xa0, 0x00, 0x01, 0xff, 0xff, 0xaa };
int longestBitString(/* you define input */)
{
int length = 0;
/* add here */
return length;
}
#2: In C, please write a function to sort a singly linked list by odd & even numbers. All odd numbers should appear at the beginning of the list. E.g. original ‘val’ of link list: 1,2,3,4,5,9,5,1; a right answer would be 1,3,5,9,5,1,2,4, or 1,1,3,5,5,9,2,4
typedef struct node
{
int val;
node* pNext;
} node;
void sortByOddEven(node **ppList)
{
}