Search:

Type: Posts; User: Cikotic

Search: Search took 0.01 seconds.

  1. Replies
    6
    Views
    1,872

    Function Overload in C

    Hi everyone,
    I was just wondering, is function overload legal in C as it is in JAVA?
    In JAVA, you can have two functions (or methods) with the same name but different argument lists and the...
  2. Replies
    30
    Views
    18,564

    OK, now this is it. I can't take this stupidity...

    OK, now this is it. I can't take this stupidity anymore. I decided to leave the original problem with reverse, hoping that if I read my new book's chapter on pointers, I would understand better. I'm...
  3. Replies
    30
    Views
    18,564

    This reminds me of an old problem I had. I'd...

    This reminds me of an old problem I had. I'd written a programme where I put the contents of the main function in a do...while() loop so that the user can be asked to repeat the process or quit. The...
  4. Replies
    30
    Views
    18,564

    I don't understand what you mean by "provide a...

    I don't understand what you mean by "provide a valid prototype to any variadic function. I know printf determines how many arguments it takes based on the first argument.

    Secondly, since when is...
  5. Replies
    30
    Views
    18,564

    So, if I only got the user to input a string,...

    So, if I only got the user to input a string, then the value of 'p' wouldn't be read only and could be manipulated by reverse?

    About pointers. for my purpose, if I declared p as an array with a...
  6. Replies
    14
    Views
    2,416

    I always do gcc -ggdb -Wall prog.c -o prog...

    I always do

    gcc -ggdb -Wall prog.c -o prog
    ggdb and Wall are just precautions and -o prog is for when you want to keep your executable after your next compile. If you keep the a.out, it'll be...
  7. Replies
    30
    Views
    18,564

    >>Let me start by asking how long you've been...

    >>Let me start by asking how long you've been doing C, prelude?
    >Coming up on ten years. Wow, kinda scary.
    Good: I still have nine and a half years to actually learn C. LOL.
    Anyway, so if I have...
  8. Replies
    30
    Views
    18,564

    Let me start by asking how long you've been doing...

    Let me start by asking how long you've been doing C, prelude?
    Now, I have two problems:
    1) what happened to the previous output? Without the \n, should the output have been:
    WORD: HELLO
    ...
  9. Replies
    30
    Views
    18,564

    Oh, here's the output: $ ./0ex4-13 Programme...

    Oh, here's the output:

    $ ./0ex4-13
    Programme to reverse all elements in a string, using recursion.
    You will be required to enter a word up to 20 letters long.
    WORD: HELLO
    Segmentation fault
  10. Replies
    30
    Views
    18,564

    int main (void) { char* s; ...

    int main (void)
    {
    char* s;
    char* p = "hello";
    printf("Programme to reverse all elements in a string, using recursion.");
    printf("\nYou will be required to enter a...
  11. Replies
    30
    Views
    18,564

    Yes, stdio.h is there. And I realize that seg...

    Yes, stdio.h is there.
    And I realize that seg faults are good things, I just blame my lack of skills in C on them. Because 1 out of 2 errors I make in C are seg faults because I don't fully...
  12. Replies
    30
    Views
    18,564

    Quick question about SIGSEGV

    I HATE SIGSEGV. Why is C programming so much harder than all the other langs? (don't answer that).
    Anyway look at the following:


    int main (void)
    {
    char* p = "hello";
    ...
    printf("\n...
  13. Replies
    3
    Views
    1,493

    Programme Efficiency

    Hi everyone,
    I've been writing programmes in C for about a year now (with some big gaps in between), and I'm never comfortable with anything I write. It seems that no matter what method I choose to...
  14. Replies
    28
    Views
    3,441

    Thanx for all your responses. Sorry, I didn't...

    Thanx for all your responses. Sorry, I didn't check in earlier.
    The programme was supposed to check if all characters in one string are the same, which I think, Salem's programme solved. Today, in...
  15. Replies
    28
    Views
    3,441

    (Im)possible Algorithm

    Hi all,
    Recently, in my computer science class, we encountered a problem in a book that seemed impossible to solve. (The teacher couldn't solve it either, so we aren't getting marks for it, which is...
  16. Replies
    7
    Views
    2,300

    This code is in JAVA. I never wrote the C...

    This code is in JAVA. I never wrote the C equivalent, but it should help you understand the math behind finding the square root of a number. This function finds the sqrt with .1 proximity.


    ...
  17. Replies
    15
    Views
    1,881

    AAAHHHH. Always the little things that slip my...

    AAAHHHH. Always the little things that slip my mind!!!

    Thanx Salem.
  18. Replies
    15
    Views
    1,881

    OK, now Cikotic's goin' really psycho. Take a...

    OK, now Cikotic's goin' really psycho.
    Take a look at this code from a different programme but with a similar concept:


    char* cc = "blah blah blah";
    char* op = " -o "; ...
  19. Replies
    15
    Views
    1,881

    Oh, I just remembered. The second argument of...

    Oh, I just remembered. The second argument of realloc() is the total size that we want for the array not the amount of memory to be added, which means your code is perfect, and I, once again, am in...
  20. Replies
    15
    Views
    1,881

    Thanx a lot, Hammer, your code makes everything...

    Thanx a lot, Hammer, your code makes everything clear now.
    But one last thing. You said

    ... t = realloc(p, ind+2) ...
    one space for the new char and one for the terminating NULL character....
  21. Replies
    15
    Views
    1,881

    WOW. This is a great board, I'm overwhelmed with...

    WOW. This is a great board, I'm overwhelmed with responses.

    Hammer, I thought static makes a var's value the same throughout different calls to the function. what do you mean by a static sized...
  22. Replies
    15
    Views
    1,881

    Thank you guys for those quick responses. ...

    Thank you guys for those quick responses.

    Salem, what do you mean drop the realloc stuff? What programme would I have without realloc?

    quzah, if I declare p as char *p;, will I still be able to...
  23. Replies
    15
    Views
    1,881

    Seg fault on string pointer

    Hi all,
    I'm new to this board. I've had some forgotten experience with C, but now I'm refreshing.

    I've always viewed string input in C as a great limitation on my programmes, because you have to...
Results 1 to 23 of 23