Thread: help with some c home work

  1. #1
    Registered User
    Join Date
    Jan 2011

    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)

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    If you have code we would love to help you, but we won't hand homework to anyone.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem in accessing root home folder....
    By Bargi in forum Linux Programming
    Replies: 1
    Last Post: 02-13-2008, 05:50 AM
  2. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 10:39 PM
  3. C++ software for home work
    By rgk44 in forum C++ Programming
    Replies: 12
    Last Post: 02-15-2006, 04:00 AM