Search:

Type: Posts; User: eurus

Search: Search took 0.01 seconds.

  1. Thread: Weird problem

    by eurus
    Replies
    8
    Views
    1,958

    Haha thanks!

    Haha thanks!
  2. Thread: Weird problem

    by eurus
    Replies
    8
    Views
    1,958

    using this code: char **maze; maze =...

    using this code:



    char **maze;
    maze = (char **) malloc(20 * sizeof(char *));

    if(maze == NULL)
    {
    printf("ERROR cannot be allocated");
  3. Thread: Weird problem

    by eurus
    Replies
    8
    Views
    1,958

    Nope switching it isnt the problem, products...

    Nope switching it isnt the problem, products output like so.

    11111111111111111111
    11111111111111111111
    11111111111111111111
    11111111111111111111
    11111111111111111111
    11111111111111111111...
  4. Thread: Weird problem

    by eurus
    Replies
    8
    Views
    1,958

    Weird problem

    Here is my input for this code.

    1
    11111111111111111111
    11111111111111111111
    1111S000G11111111111
    11111111111111111111
    11111111111111111111
    11111111111111111111
    11111111111111111111
  5. Replies
    3
    Views
    1,270

    thanks a bunch

    thanks a bunch
  6. Replies
    3
    Views
    1,270

    Example: struct stackNode **xstack;...

    Example:


    struct stackNode **xstack;
    push(xstack, 5);
    push(xstack, 5);


    printf("%d %d", pop(xstack), pop(xstack));
  7. Replies
    3
    Views
    1,270

    Problem using two stacks with following code

    Im getting crashes if I initialize more than one stack using this code.




    struct stackNode{

    int data;
    struct stackNode *nextptr;
    };
  8. Replies
    3
    Views
    3,335

    Having trouble solving maze.

    Hello, I have a task of solving a 20 by 20 maze. The problem im facing is that currently, I take a .txt file in and have to solve a maze for J amount of mazes.

    Im having problems getting my if...
  9. Replies
    5
    Views
    1,077

    so should do something like if(fscanf("%d",...

    so should do something like

    if(fscanf("%d", &array[i][j])

    else(fscanf("%c", &array[i][j])
  10. Replies
    5
    Views
    1,077

    Ok gotcha, so if I didn't know when the character...

    Ok gotcha, so if I didn't know when the character was going to be coming in how would I cast it to take the acsii code for the two letters while still taking in the integers?
  11. Replies
    5
    Views
    1,077

    Question about arrays.

    I have a two dimensional array that will be taking in about 38 numbers and 2 letters randomly.


    I allocate the memory for 20 columns and 20 lines and take in simple 1 digit numbers and two...
  12. Replies
    6
    Views
    1,287

    Ah yes, create some sort of a flag inside the...

    Ah yes, create some sort of a flag inside the loop to exit out or modify your while statement.
  13. Replies
    2
    Views
    1,884

    I know bubble sort has O(n^2) and that is really...

    I know bubble sort has O(n^2) and that is really bad, anyone have an extremely fast way of going about this? (sorting LOTS of strings)
  14. Replies
    2
    Views
    1,884

    Alphabetizing n words.

    My question is:
    What is the best algorithm for alphabetizing strings of chars in C?
  15. Replies
    6
    Views
    1,287

    try putting else in brackets? else { ...

    try putting else in brackets?



    else
    {

    printf("How many individual units of food do you wish to buy: ");
    scanf("%d", &amount);
  16. Replies
    17
    Views
    5,034

    No compile errors or anything but wondering if...

    No compile errors or anything but wondering if thats bad style/practice.
  17. Replies
    17
    Views
    5,034

    Alright, I understand that now does that apply...

    Alright, I understand that

    now does that apply for needing 2 elements per line

    am I not allocating enough to have 2 elements(each with 30 chars) on x number lines?


    should I
  18. Replies
    17
    Views
    5,034

    with the [0][0] though I get an error, only works...

    with the [0][0] though I get an error, only works with


    scanf("%s %s", c2names[0]);


    and that was a typo for the post should be


    scanf("%s %s", c2names[0][0], c2names[0][1]);
  19. Replies
    17
    Views
    5,034

    ok input via file ** 2 2 Hi there my name...

    ok

    input via file
    **
    2 2
    Hi there
    my name
    **

    2 and 2 is the numbers that signify 2 rows. 2 columns
  20. Replies
    17
    Views
    5,034

    Well heres what is going on in my head, I want...

    Well heres what is going on in my head,

    I want to take in say 10 lines and 2 words per line (seperate)

    so


    char **c2names;

    c2names = (char **) malloc(amount_of_lines * sizeof(char *));
  21. Replies
    17
    Views
    5,034

    yes but what if I want to take in 2 words

    yes but what if I want to take in 2 words
  22. Replies
    17
    Views
    5,034

    correct way to call it would be scanf("%s...

    correct way to call it would be


    scanf("%s %s", c2names[0][0], c2names[0][0]);

    ?
  23. Replies
    17
    Views
    5,034

    Two dimensional char array

    Here is what I basically need:

    I need to be able to take in say 2 words on 10 lines
    each word can be a maximum of 30 chars

    heres what I have but it seems incorrect:


    char **c2names;...
Results 1 to 23 of 23