Search:

Type: Posts; User: Krabiki

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    772

    Thanks @grumpy...

    Thanks @grumpy for the detailed explanation.

    I used the Boomerang Decompiler for this.
  2. Replies
    3
    Views
    772

    scanf() works without parameters ?

    I used a decompiler to decompile a C program and this is the result :



    // address: 0x8048504
    int main(int argc, char **argv, char **envp) {
    char local0[1024]; // m[r28 - 29]
    ...
  3. Replies
    14
    Views
    973

    Hmm I think setting the struct int variable id to...

    Hmm I think setting the struct int variable id to 0 will solve the issue, but I can't figure out how to do it.

    Sample code, working code snippet showing the seg fault at the line in which it...
  4. Replies
    14
    Views
    973

    I don't think I did any memory allocation for the...

    I don't think I did any memory allocation for the pointer =/

    The ptr*[1000] actually points to the address of another array which is storing the struct.

    Updated the code in the previous post.
  5. Replies
    14
    Views
    973

    Okay I found the source of the segmentation...

    Okay I found the source of the segmentation fault.

    Hmm how do I properly check if the struct variable id is 0 ?

    Non-global int variables are undefined in C from what I found out, so some...
  6. Replies
    14
    Views
    973

    Hmm maybe my phrasing of the sentence is wrong.....

    Hmm maybe my phrasing of the sentence is wrong.. When I run the file in GDB, it simply runs without any errors.

    What I Did
    gcc -ggdb main.c
    gdb ./a.out
    <run>

    will simply run the file with...
  7. Replies
    14
    Views
    973

    GDB doesn't produce any errors as it can be...

    GDB doesn't produce any errors as it can be compiled in GCC ..

    I try to see if there's any errors lurking somewhere....
  8. Replies
    14
    Views
    973

    Compiler errors.

    I have a c file which can be compiled in Linux via GCC , but when I compile it in NetBeans via Cygwin or MinGW , it doesn't work and keeps throwing a segmentation fault.

    Any ideas on how to solve...
  9. Replies
    1
    Views
    710

    Array containing pointers to structures.

    How do I store pointers to a struct in an array ?

    I am using sprintf to concatenate some values together and then output it to an array in its 1st argument.

    A portion of my code is shown...
  10. Replies
    3
    Views
    685

    Oh yeah thanks for the clarification, a moment of...

    Oh yeah thanks for the clarification, a moment of confusion there haha :D
  11. Replies
    3
    Views
    685

    Memory allocation for pointers.

    p = malloc(...);
    q = malloc(...);
    p=q;

    The final result is that both variables point to the memory block of q.

    Why is this so ?

    Shouldn't the memory block of q point to p instead ? As q...
  12. Replies
    5
    Views
    825

    vart...

    vart , thanks for correcting my code logic and the errors :) .

    On the other hand, why does a global variable not work ? A global variable is supposed to have the scope of the whole file right ?
  13. Replies
    5
    Views
    825

    Yes, I need to transform it to char because the...

    Yes, I need to transform it to char because the given printf() function accepts char parameters.

    I did some debugging and some inspiration from your code, the issue seems to lie in the conversion....
  14. Replies
    5
    Views
    825

    Mutiple function definition errors.

    I am getting multiple function declaration errors when I try to execute the code.

    I did a function declaration at the start, is the way I did it wrong ?



    #include <stdio.h>
    #include...
  15. Oh thanks for the explanation. Didn't thought of...

    Oh thanks for the explanation. Didn't thought of operator precedence being the issue =)
  16. Wow rcgldr...

    Wow rcgldr, thanks for the example, the volatile keyword sounds foreign to me though haha =)
  17. Thanks a lot. Hmm why is the parentheses required...

    Thanks a lot. Hmm why is the parentheses required in this case ?
  18. Thread: getchar() help

    by Krabiki
    Replies
    5
    Views
    1,144

    Hmm I may be wrong, but aren't continue and break...

    Hmm I may be wrong, but aren't continue and break statements "forbidden" in if-else statements ?
  19. Writing functions to prove that variables cannot be changed by another function.

    It is said that variables in a function cannot be changed by another function. Only by using pointers can variable values be changed.

    I am writing some functions to try to prove this theory, but I...
  20. Very clear explanation sonjared ;) , many thanks.

    Very clear explanation sonjared ;) , many thanks.
  21. Hmm isn't it the same case when the user enters...

    Hmm isn't it the same case when the user enters '1' or '2' ? There shouldn't be any characters in the stream too right ?
    Or is it because for '1' and '2' , the presence of scanf causes some...
  22. I am sorry, I don't get the part of "no remaining...

    I am sorry, I don't get the part of "no remaining characters in the stream" =/. Could you explain further ?



    Do you mean unifying the input method as in joining the fgets and sscanf in a single...
  23. Remove the need for an ENTER key to be pressed.

    The following 2 codes are almost identical, only that the switch statements are slightly different.

    The 2nd code has the issue of requiring an additional enter key to be pressed when I enter '3'...
  24. Replies
    9
    Views
    2,121

    After some research, fgets and sscanf is more...

    After some research, fgets and sscanf is more recommended over scanf.

    I tried implementing in my code, but there's an infinite loop without any chance for me to enter any input . Why is this so ?...
  25. Replies
    9
    Views
    2,121

    Great link, I've read the 2nd part about flushing...

    Great link, I've read the 2nd part about flushing the buffer. The author raised an important point, what if the user entered more than 1 character, the program will fail. So, flushing the buffer will...
Results 1 to 25 of 35
Page 1 of 2 1 2