Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.20 seconds.

  1. Replies
    8
    Views
    132

    That's what I had in mind when I wrote that "just...

    That's what I had in mind when I wrote that "just that certain implementations may permit it for their own use cases".


    No, just assigning an arbitrary address without doing pointer arithmetic is...
  2. Replies
    8
    Views
    132

    The rule that you might be thinking of is the one...

    The rule that you might be thinking of is the one about pointer arithmetic with respect to the elements of an array: in such a case the standard defines addition of an integer to a pointer such that...
  3. Replies
    19
    Views
    409

    On the contrary, you do have to declare variables...

    On the contrary, you do have to declare variables before assigning to them (or from them, for that matter).

    Anyway, the reason why john.c is facepalming so hard is that the tutorial that Salem was...
  4. Replies
    19
    Views
    409

    oods1, do you have a computer programming...

    oods1, do you have a computer programming background, and are you familiar with the C programming language?
  5. Replies
    3
    Views
    139

    If you're willing to use the non-standard but...

    If you're willing to use the non-standard but POSIX-standard getline function, then life is somewhat easier:

    char *line = NULL;
    size_t len = 0;
    if (getline(&line, &len, stdin) != -1)
    {
    //...
  6. No, let's take a look at this line: ...

    No, let's take a look at this line:

    *(ptr_arr+i) = word;
    it would be slightly easier if we transformed it to use array notation:

    ptr_arr[i] = word;
    ptr_arr[i] is an int, whereas word is a...
  7. Replies
    8
    Views
    227

    I would start by defining a function to print a...

    I would start by defining a function to print a single employee's data:

    void print_employee(FILE *fp, const Employee *employee);
    I would manually create an Employee object and test this...
  8. Your compiler is right: to compute the height,...

    Your compiler is right: to compute the height, you don't need to modify the struct object, therefore this:

    int vertexheight(struct parabola * p, double *y);
    should have been:

    int...
  9. The easiest may well be to just compare the...

    The easiest may well be to just compare the characters:

    if (a[4] == 'J' && a[13] == 'R')
    If you really want to form a string out of them:

    char sample[3] = "";
    sample[0] = a[4];
    sample[1] =...
  10. Thread: memcmp ?

    by laserlight
    Replies
    6
    Views
    219

    Write the loop and place it in a function that...

    Write the loop and place it in a function that returns a value that you can then check in a conditional. Problem solved.
  11. Replies
    1
    Views
    122

    Just work with 16 characters at a time. It...

    Just work with 16 characters at a time. It wouldn't be a null terminated string, but you probably don't need that for encryption.
  12. That implies that the array of pointers is an...

    That implies that the array of pointers is an array of char pointers (i.e., char*[N]), which means that the parameter should be a pointer to a pointer to char (i.e., char**).


    By using pointers....
  13. Replies
    2
    Views
    180

    Your swap is wrong: it should be of the form: ...

    Your swap is wrong: it should be of the form:

    temp = x;
    x = y;
    y = temp;
    The next problem is that you need to swap with a pointer that doesn't have the '-' prefix, not with a fixed pointer....
  14. hamster_nz went over a bunch of your mistakes,...

    hamster_nz went over a bunch of your mistakes, but you didn't seem inclined to go through them.
  15. If you already found the word, grabbing the 8...

    If you already found the word, grabbing the 8 bits is just a matter of computing where they start and copying them.


    Write it. If you find it too hard, work on a simplified version of this...
  16. That pseudocode does search for the word: that...

    That pseudocode does search for the word: that search is described by "If prefix seen at position x". It can be a simplistic loop that checks if there's an exact match. If there's a mismatch,...
  17. Okay, let's try this: input = 1 1 0 0 0 0 1 1...

    Okay, let's try this:
    input = 1 1 0 0 0 0 1 1
    selector = 4

    So, first we examine 1 1 0 0. We see that the very first integer is 1. This means that the result for this group is 0. Then, we examine...
  18. If you're going to assume that the input is...

    If you're going to assume that the input is correct, then this seems rather trivial. For example:

    #include <iostream>
    #include <vector>

    std::vector<int> unmap(const std::vector<int>& input,...
  19. * moved to C++ programming forum *

    * moved to C++ programming forum *
  20. Replies
    8
    Views
    384

    You need to remove the trailing newline character...

    You need to remove the trailing newline character that fgets reads and stores in the string.
  21. Replies
    8
    Views
    384

    It works for me: #include #include...

    It works for me:

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

    int checkWord(char word[])
    {
    size_t len = strlen(word);
    if(word[0] != '&' || word[len-1] != ';')
  22. Replies
    8
    Views
    384

    You have to remove the else return 1 otherwise...

    You have to remove the else return 1 otherwise your loop will be dead code.
  23. Replies
    8
    Views
    384

    The check for '&' and ';' should be done just...

    The check for '&' and ';' should be done just once, outside of the loop. You'll just need to adjust the start and end conditions of the loop to avoid checking them in the loop, because that's why...
  24. Replies
    4
    Views
    299

    Imagine that the address of mask was 1000. Then...

    Imagine that the address of mask was 1000. Then the address of word would start from 1000 onwards. So, if the address of word is 1004, word - mask = 4, whereas mask - word = -4, which wouldn't make...
  25. When you say "RXData is 32 deep", you mean that...

    When you say "RXData is 32 deep", you mean that it has a size of 32 bytes? How many bytes is the size of RXData[0]?

    But yeah, what you have shown should not result in overwriting memory...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4