Thread: Structures etc

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    5

    Structures etc

    Hello Board,

    Im quite new to c-programming - not very advanced.

    Im currently delving through someone's elses C-code -I have to convert his C-code into an exact MATLAB equivalent.

    Anyway, Im having trouble understanding some of the C - structures in particular.

    Can anyone tell me, in simle terms whats happening in the following function. Im most interested in how the structures work Is anyone able to give me a run down?:

    Code:
    void fix_power_level (SIGNAL_INFO *info, char *name, long maxNsamples) 
    {
        long   n = info-> Nsamples; //????
        long   i;
        float *align_filtered = (float *) safe_malloc ((n + DATAPADDING_MSECS  * (Fs / 1000)) * sizeof (float));    
        float  global_scale;
        float  power_above_300Hz;
    
        for (i = 0; i < n + DATAPADDING_MSECS  * (Fs / 1000); i++) {
            align_filtered [i] = info-> data [i]; // ?????????
        }
        
    apply_filter (align_filtered, info-> Nsamples, 26, align_filter_dB);
    
    }
    Thanks for any advice/help.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    long n = info->Nsamples;
    Take the value of 'Nsamples' in the structure pointed to by 'info', and assign it to 'n', which is a 'long'.

    The arrow operator is used to access structure members when you're accessing the structure through a pointer.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  2. Structures, passing array of structures to function
    By saahmed in forum C Programming
    Replies: 10
    Last Post: 04-05-2006, 11:06 PM
  3. Input output with structures
    By barim in forum C Programming
    Replies: 10
    Last Post: 04-27-2004, 08:00 PM
  4. pointers to arrays of structures
    By terryrmcgowan in forum C Programming
    Replies: 1
    Last Post: 06-25-2003, 09:04 AM
  5. Methods for Sorting Structures by Element...
    By Sebastiani in forum C Programming
    Replies: 9
    Last Post: 09-14-2001, 12:59 PM