Search:

Type: Posts; User: mherald81

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    1,796

    Maybe because you're trying to copy a char array...

    Maybe because you're trying to copy a char array into a single char?

    You could try changing your struct to this:



    struct Room {
    char south, north, east, west;
    char id[2];
    char...
  2. Replies
    6
    Views
    8,848

    I don't think it's good practice to use void...

    I don't think it's good practice to use void main().


    /*c program to find out the maximum and the second maximum number from an
    array of integers*/
    #include<stdio.h>

    int main(void)
    {
    ...
  3. Thread: heap sort

    by mherald81
    Replies
    16
    Views
    7,516

    Ok here's my updated code. However I'm not too...

    Ok here's my updated code. However I'm not too sure how to check without making everything uppercase or lowercase.

    ...
  4. Thread: heap sort

    by mherald81
    Replies
    16
    Views
    7,516

    It's actually not because of 3 consecutive...

    It's actually not because of 3 consecutive letters, but instead some of the strings in your input has the first character as a lowercase. I will have to work on fixing that.
  5. Replies
    3
    Views
    5,679

    Give it a try on your own first before asking for...

    Give it a try on your own first before asking for help.
  6. Thread: heap sort

    by mherald81
    Replies
    16
    Views
    7,516

    laserlight, Can you look over this and make...

    laserlight,

    Can you look over this and make sure everything is ok.


    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    void swap(char** first, char** second);
  7. Replies
    3
    Views
    873

    int somefunction() { if(....) return value;...

    int somefunction()
    {
    if(....)
    return value;
    .
    .
    . // Some work here
    .
    .
    }
  8. Replies
    3
    Views
    873

    inline returns

    I think I know, but not sure on the terminology. What is an inline return and how does it differ from a normal return.

    Please give me some examples.
  9. Thread: heap sort

    by mherald81
    Replies
    16
    Views
    7,516

    Something like this? I'm still messing around...

    Something like this? I'm still messing around with it to get it working but would appreciate any hints or suggestions.


    void readInputFile(FILE *input)
    {
    char *temp;
    char username[80];
    ...
  10. Thread: heap sort

    by mherald81
    Replies
    16
    Views
    7,516

    Is there a way to modify it to accept any number...

    Is there a way to modify it to accept any number of elements? I had the bound set to 10 just to test it out.
  11. Thread: heap sort

    by mherald81
    Replies
    16
    Views
    7,516

    Ok, I'm trying to change it up a bit to read from...

    Ok, I'm trying to change it up a bit to read from a file but I'm having issues. The function that I'm having trouble creating is readInputFile.


    #include <stdio.h>
    #include <stdlib.h>
    #include...
  12. Thread: heap sort

    by mherald81
    Replies
    16
    Views
    7,516

    Thanks, I keep forgetting. I got it working.

    Thanks, I keep forgetting. I got it working.
  13. Thread: heap sort

    by mherald81
    Replies
    16
    Views
    7,516

    Updated it a bit, but still have some issues. ...

    Updated it a bit, but still have some issues. It's only sorting based on the first letter. So if I have 2 words that start with the same letter it won't sort correctly.


    #include <stdio.h>...
  14. Thread: heap sort

    by mherald81
    Replies
    16
    Views
    7,516

    No errors, just that it doesn't sort the names...

    No errors, just that it doesn't sort the names correctly.

    original:
    "Darin"
    "David"
    "Brian"
    "Dog"
    "Nikki"
    "Aaron"
    "Robert"
  15. Thread: heap sort

    by mherald81
    Replies
    16
    Views
    7,516

    heap sort

    I had this working in C++ but wanted to get a C version. I'm pretty sure I'm getting lost with the pointers. I would appreciate any help.


    #include <stdio.h>
    #include <stdlib.h>
    #include...
  16. Replies
    1
    Views
    710

    Function Pointers

    I need some help understanding function pointers.

    syntax:

    int (*pt2Function)(float, char, char) = NULL;

    I'm just confused on how to really use them and their usefulness.
  17. Replies
    3
    Views
    877

    nevermind, I got it working.

    nevermind, I got it working.
  18. Replies
    3
    Views
    877

    What do you mean?

    What do you mean?
  19. Replies
    3
    Views
    877

    Need some help initializing a pointer.

    I'm need some help initializing a pointer. Below is a segment of my code that I'm working on. The pointer that I need help with is subjectPtr.


    #include <stdio.h>
    #include <stdlib.h>
    #include...
  20. Replies
    21
    Views
    6,473

    So strcat(y, p+1) concatenates without the space...

    So strcat(y, p+1) concatenates without the space at the beginning of p and strncat(y,p,1) concatenates the space at the end. And *p=0 sets where p is pointing to in memory to 0? And the loop will...
  21. Replies
    21
    Views
    6,473

    Can you explain this loop a bit for me? ...

    Can you explain this loop a bit for me?


    while( p!=s )
    if( strchr(delims,*--p) )
    strcat(y,p+1),strncat(y,p,1),*p=0;


    It's mainly the strcat line that I'm lost on because all of...
  22. Replies
    21
    Views
    6,473

    Thanks. I can see why that would be useful for...

    Thanks. I can see why that would be useful for this program.
  23. Replies
    21
    Views
    6,473

    What's the difference between calloc and malloc?

    What's the difference between calloc and malloc?
  24. Thread: Binary Tree

    by mherald81
    Replies
    4
    Views
    1,171

    I would say use google and search for some...

    I would say use google and search for some reference code and give it a try. I'm in the process of learning C and was able to use google to make sure my syntax is fine and make a binary search tree....
  25. Replies
    21
    Views
    6,473

    Here's my final edits to get it working. ...

    Here's my final edits to get it working.


    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    int main()
    {
    char a[] = "Dog eat Cat";
Results 1 to 25 of 43
Page 1 of 2 1 2