min max of array pthread

This is a discussion on min max of array pthread within the C Programming forums, part of the General Programming Boards category; this is what i have been given Code: //global data variables #define ARRAY_LEN 1000000 int array[ARRAY_LEN]; int maxNum, minNum; #include ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    29

    min max of array pthread

    this is what i have been given

    Code:
    //global data variables 
    #define ARRAY_LEN 1000000
    int array[ARRAY_LEN];
    int maxNum, minNum;
    
    #include <pthread.h>
    
    int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg);
    
    //void findMax() - assign the max. number to above maxNum 
    //void findMin() - assign the min. number to above minNum
    
    //complete the main program, find MM.c
    Last edited by ilikeapplepie; 03-07-2011 at 04:41 PM.

  2. #2
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    So? We won't do your homework for you.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,676
    That's not a very interesting story. You lack character development and plot structure.

    You figured out you need to use code tags, I hope you also read the sticky thread that describes our homework policy.

    Now, make a serious attempt to do your homework, post your code, ask serious questions and you'll get serious help.

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Well, all that AND... I really don't think you want to be creating a 4 megabyte array in your program's stack... Try malloc()

  5. #5
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    The array looks like global. ..as commented;-)
    to op, there are many pthread tutorials. Just google.
    Last edited by Bayint Naung; 03-07-2011 at 05:16 PM. Reason: typing from ph. correct spelling misteak:-P

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Bayint Naung View Post
    The array loos like global. ..as commented;-)
    "loos" ???

  7. #7
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,676
    Looks

  8. #8
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,264
    Quote Originally Posted by CommonTater
    Well, all that AND... I really don't think you want to be creating a 4 megabyte array in your program's stack... Try malloc()
    Global arrays are not created on the stack.
    bit∙hub [bit-huhb] n. A source and destination for information.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Text files and validation
    By Futomara in forum C Programming
    Replies: 34
    Last Post: 11-02-2010, 01:10 PM
  2. Ranged numbers
    By Desolation in forum Game Programming
    Replies: 8
    Last Post: 07-25-2006, 11:02 PM
  3. max or min
    By drdodirty2002 in forum C++ Programming
    Replies: 6
    Last Post: 10-16-2004, 10:37 PM
  4. Merge sort please
    By vasanth in forum C Programming
    Replies: 2
    Last Post: 11-09-2003, 12:09 PM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 10:48 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21