Search:

Type: Posts; User: Lina_inverse

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    1,482

    Can you take a look of the new code, this one...

    Can you take a look of the new code, this one just adds all the numbers entered and print out the sum.




    #include <pthread.h>
    #include <stdio.h>
    int sum; /* this data is shared...
  2. Replies
    4
    Views
    1,482

    [C] Basic multi-thread programming help

    I want to create 2 threads, one does the max and one gives the average of a list of numbers entered in the command line.



    #include <stdio.h>
    #include <pthread.h>
    #include...
  3. Replies
    1
    Views
    4,107

    Multi-thread programming help

    So I am very new to multi-thread programming using Pthread in Linux. Can someone show me an example of something like taking a list of numbers on the command line and will then create three separate...
  4. Replies
    1
    Views
    1,821

    Signals and forks

    i am asked to find all the possible outputs in this question:




    #define N 4
    int val = 9;
    void handler(sig) { val += 3; return;}
    int main() {
    pid_t pid;
  5. Replies
    3
    Views
    2,379

    can u tell me if this is correct? compiler:...

    can u tell me if this is correct?

    compiler: spec.tab.o lex.yy.o
    gcc spec.tab.o lex.yy.o -ly –ll
    lex.yy.c: spec.l
    flex spec.l
    spec.tab.c: spec.y
    bison -vd spec.y
    spec.tab.o: spec.tab.c
    gcc...
  6. Replies
    3
    Views
    2,379

    Creating a Makefile, help

    Give a makefile (doesn't have to be a separate file - just what the contents would be) that would generate the application described below. Be sure each generated file has its own rule.

    The first...
  7. Replies
    1
    Views
    1,559

    Reading files and manipulate queues

    So I am trying to write this function, read_deck, which is:


    **void read_deck(char *filename, queue *deck)**


    This function takes a character string of a file name. It opens the file...
  8. Replies
    2
    Views
    2,482

    bytes allocation question

    Im not sure how to do this, it is in the following link:

    http://i.imgur.com/PKfyL.jpg
  9. Replies
    2
    Views
    1,602

    Linked list and nodes

    Hi i am writing this piece of code which takes 3 field , store it into struct, but i dont know how to create the node and the function print_planet_list() should walk through the linked list and...
  10. Replies
    5
    Views
    1,061

    for (i=0; i

    for (i=0; i<rows; rows++){

    for (j=0; j<cols; cols++)
    {

    ans[i] = ans[i] + mat[i][j] * vec[j];
    }
    }

    still 0s
  11. Replies
    5
    Views
    1,061

    oh thanks, well i changed to: #include...

    oh thanks, well i changed to:


    #include <stdlib.h>
    /* Multiply a matrix by a vector. */
    double *matrix_vector_multiply(int rows, int cols,
    double **mat, double...
  12. Replies
    5
    Views
    1,061

    multiplying a matrix and vector:

    the logic for multiplying a matrix: mat[row][col] and a vector : vec[row]

    is the following?



    double *ans = malloc(rows * sizeof (double));
    int i;
    for (i=0; i<rows; rows++)
    ...
  13. my read_vector is not even letting me enter the...

    my read_vector is not even letting me enter the numbers for some reason.
  14. For the read matrix function: double...

    For the read matrix function:


    double **read_matrix(int rows, int cols){

    typedef struct matrix
    {
    int rows;
    int cols;
    double **entries;
  15. and btw, how do print out the numbers in the...

    and btw, how do print out the numbers in the format of : ie. positive .2 is a 2.00e-01
  16. by using a struct, how do i store the inputs into...

    by using a struct, how do i store the inputs into the array?
  17. this is my print vector function: /*...

    this is my print vector function:



    /* Print a vector with n entries pointed to by vec. */
    void print_vector(int n, double *vec){
    int i;
    for (i=0; i<n; i++) {
    printf("%d", vec[i]);
    }
  18. changed some things: double *read_vector(int...

    changed some things:


    double *read_vector(int n){
    double *vec = (double *) malloc (sizeof(double)*n);
    int i;
    for (i=0; i<n; i++)
    vec[i] = n;
    return vec;
    }
  19. how do I read the inputs in?

    how do I read the inputs in?
  20. reading a matrix and printing out the matrix

    Hi Im writing a function to read the matrix user enters and print it out, the main function:



    double **read_matrix(int rows, int cols);
    void print_matrix(int rows, int cols, double **mat);

    ...
  21. Read inputs for an dynmaically allocated array

    I want to read user's input for my array using pointers, allocated space, read elements and return pointer.

    my function is called read:



    double read *read_vector (int n) // n is the size of...
  22. Replies
    11
    Views
    1,339

    edit: o i see what u mean with the [i].. thanks!

    edit: o i see what u mean with the [i].. thanks!
  23. Replies
    11
    Views
    1,339

    it just prints out 0's 12032

    it just prints out 0's
    12032
  24. Replies
    11
    Views
    1,339

    thanks for the fgets info. But Im still not too...

    thanks for the fgets info. But Im still not too sure how to fix the printing out information.. [i] should be used since im printing solarsys[1], solarsys[2],.. and on. right?
  25. Replies
    11
    Views
    1,339

    so i have made some changes to the code, the user...

    so i have made some changes to the code, the user now can enter all the information in one single line. but when i try to print out the info the user entered, it only displays: 0.00000 for all the...
Results 1 to 25 of 52
Page 1 of 3 1 2 3