Thread: Segment woes

  1. #1
    Registered User
    Join Date
    Apr 2007

    Segment woes

    //TJ Wright 11 3
    #include <stdio.h>
    int main ()
    int m, count=0,n[30];
    printf("Enter the numbers, one per line");
    scanf("%d",&n[m]);/* input up to 20 integers, one per line, the sentinel is 0
    		  each of the numbers will be less than 2^30.*/
    for (m=1;m<=count;m++)
    if statements asking if there is a number n such that all the integers
    are in the segment [n, n+32767]. If there is such a number, print the largest
    such n. If there is not, determine if there is a number n such that
    all but  1 of the integers is in the segment [n,n+32767]. If there is such
    a number, print the largest such. If there is no such, determine if there is
    such an n so that all but two of the intervals are in the interval and print
    the largest such. Continue this way until n is found.*/
    return 0;
    The second comment paragraph is the purpose of the program. I can't wrap my head around the logic of it, I cant figure out how I'd apply c programming to solve the problem.

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Rishon LeZion, Israel
    Last edited by Salem; 06-01-2007 at 10:09 AM. Reason: fix link?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    David J. Wheeler

  3. #3
    Registered User
    Join Date
    Apr 2007
    That link provided doesnt go to a thread

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    It does now.
    Next time, press "edit post" rather than reposting with a bit of text you forgot to add.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mutex and Shared Memory Segment Questions.
    By MadDog in forum Linux Programming
    Replies: 14
    Last Post: 06-20-2010, 04:04 AM
  2. execute a code in data segment...
    By ravindragjoshi in forum Windows Programming
    Replies: 1
    Last Post: 06-12-2007, 11:43 PM
  3. Segment woes
    By astrodude15 in forum C Programming
    Replies: 2
    Last Post: 06-04-2007, 06:45 AM
  4. Declare an array in the BSS segment
    By ^xor in forum C Programming
    Replies: 1
    Last Post: 05-27-2005, 05:12 PM
  5. LISP (DrScheme) any one?
    By Jeremy G in forum A Brief History of
    Replies: 5
    Last Post: 03-31-2004, 12:52 PM