Search:

Type: Posts; User: KenJackson

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    994

    Only 1 byte is being allocated in the second...

    Only 1 byte is being allocated in the second program. Try replacing

    stri=(char *)malloc(sizeof(char));
    with

    stri=(char *)malloc(512);
  2. Replies
    3
    Views
    994

    char name[STUDENTS][20]={'\0'}; int...

    char name[STUDENTS][20]={'\0'};
    int marks[STUDENTS][SUBJECTS+1]={0};
    inputmarks(name,marks);
    ...
    inputmarks(char *string[STUDENTS],int arr[][SUBJECTS+1])
    {
    ...
    string[i]=(char...
  3. Replies
    8
    Views
    1,014

    Is chipmemory declared as an array of unsigned...

    Is chipmemory declared as an array of unsigned char?
    If it is, your code looks like it should work.

    But if your emulator is emulating ROM, maybe it's refusing to let you write.
    Did you declare...
  4. This is my favorite way to handle such tasks. ...

    This is my favorite way to handle such tasks.

    static const char *mfg[] = {
    "(none)", "3M Corporation", "Maxwell Corporation",
    "Sony Corporation", "Verbatim Corporation"
    };
    ...
  5. Replies
    16
    Views
    4,336

    That's the theory, but we're mimicking a UART...

    That's the theory, but we're mimicking a UART here so the hardware doesn't do it. The handshaking signal can only cause an interrupt and then it's up to software to stop sending. And it's up to...
  6. Replies
    16
    Views
    4,336

    Flow control is a throwback to the days of the...

    Flow control is a throwback to the days of the teletype. I don't think it's every any more useful than a 5-bit word size.


    Good point.
  7. It's safer to use strncpy(). void...

    It's safer to use strncpy().


    void text_test3(char *array)
    {
    char char_array[40];
    strncpy(char_array, array, sizeof(char_array));
    char_array[sizeof(char_array) - 1] = 0; /*...
  8. You've declared a function inside a function. ...

    You've declared a function inside a function. Some languages allow that, but not C. The print() function must be moved outside main().


    void print(int opt, int h, int m, float pay)
    {
    ...
  9. Replies
    2
    Views
    2,855

    How do I compare cloned github projects?

    Github makes it very easy to clone an existing project so you can make your own version the way you want to. But I don't see any way to easily compare a project to a clone to see what's different.
    ...
  10. while (total

    while (total <= 0 || q == 'n');

    That trailing semicolon counts as the whole loop. Delete it.
  11. The second argument to scanf() should be a...

    The second argument to scanf() should be a pointer, &bet (this could cause the crash).

    Variable total is not initialized, so you're subtracting bet from a random number.

    The second argument to...
  12. Replies
    6
    Views
    1,204

    What platform are you working on? Almost every...

    What platform are you working on?

    Almost every popular file system (except the ones Windows uses) supports symbolic links.
    So if you're lucky (i.e. not using Windows) you can go into a directory...
  13. I consider it a bug to declare a function...

    I consider it a bug to declare a function parameter (in C++ obviously) as a reference (with &) if the value is modified in the function. The problem is, you can't tell by looking at the function...
  14. Does it run if you start it from the command...

    Does it run if you start it from the command line?
    That is, just type the command I:\rap00 and see if it starts.

    Also, are you sure you're consistently using two zeros, not two capital Os?
  15. Replies
    6
    Views
    5,424

    This bubble sort function is operating on a...

    This bubble sort function is operating on a two-dimensional array.
    It's not clear what the correct result is.

    It loops through the divers (first index) once, so I guess we want to sort the divers...
  16. Replies
    6
    Views
    5,424

    Function getData() returns before calling...

    Function getData() returns before calling BubbleSort(), so BubbleSort() is never called.

    But if BubbleSort() were called, it would access element score[.][size], which is beyond that end of data....
  17. Instead of that second fgets() call, I think you...

    Instead of that second fgets() call, I think you meant this, which I think should work:

    if (info == NULL)
    { /* error! */ }
    memset(record, 0, sizeof(record)); /* In case of...
  18. Replies
    1
    Views
    1,015

    Gosh. I did some Fortran back in the '80s, but I...

    Gosh. I did some Fortran back in the '80s, but I wouldn't touch it today if I didn't have to.

    I've come to appreciate C even more than C++, but they can both do arrays with aplomb.

    What...
  19. const char fruit[6][8] = {...

    const char fruit[6][8] = { "Cherry","Lemon","Plum","7","Melon","Bar" };
    srand(time(0));
    int wheel1 = rand() % 6;
    int wheel2 = rand() % 6;
    int wheel3 = rand() % 6;

    printf("%s\n%s\n%s\n",...
  20. Replies
    2
    Views
    1,160

    I didn't try to compile it, but it just looks...

    I didn't try to compile it, but it just looks like there's a misplaced set of curly braces. If you move them them, indent, and delete other superfluous braces, you get something like this:

    //...
  21. Replies
    14
    Views
    2,831

    BTW, I don't know how well your technique will...

    BTW, I don't know how well your technique will work for converting lower case to upper, but either of these methods would cause upper and lower case be accepted equally:


    switch (type) {...
  22. Replies
    6
    Views
    880

    Do you need to prompt? If it's a command-line...

    Do you need to prompt?

    If it's a command-line program, I find it much, much better to pass parameters on the command line. Then parse them and either use them or spit out an error message and...
  23. Replies
    2
    Views
    1,966

    I didn't analyze very much of it, but using an...

    I didn't analyze very much of it, but using an uninitialized pointer is always asking for trouble.

    It helps to draw pointer problems out with boxes and arrows.

    I also find that double...
  24. Replies
    12
    Views
    1,625

    I missed a couple posts that came quickly. I...

    I missed a couple posts that came quickly.


    I fear rags_to_riches is right.


    It's already in a separate directory, but I refer back to the source in it's original directory because there are...
  25. Replies
    12
    Views
    1,625

    I set C_INCLUDE_PATH to the current directory,...

    I set C_INCLUDE_PATH to the current directory, exported and tried again. No difference.

    I also just found -iquote that looked promising. But didn't work.
Results 1 to 25 of 46
Page 1 of 2 1 2