Search:

Type: Posts; User: envec83

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    1,957

    How C programs store string literals?

    The output of the following program:


    int main(){
    int x = "test";
    int y = "test";

    printf("%u %u\n",x,y);

    return 0;
  2. Replies
    6
    Views
    20,707

    Optimial topoligical sorting algorithms run...

    Optimial topoligical sorting algorithms run indeed in linear time pretty much. However, I coded my own solution, which is sub-optimal and run in nē time. I basically create an adjacency matrix and...
  3. Replies
    6
    Views
    20,707

    How To Stop A Program After 10 Seconds?

    I am working on a program to make topological sorts, but depending on size of the dataset given the time to compute everything is too large.

    I want to add a command to my program to make it track...
  4. Replies
    23
    Views
    9,267

    Gotcha. Thanks guys.

    Gotcha. Thanks guys.
  5. Replies
    23
    Views
    9,267

    How Are C Arrays Represented In Memory?

    I believe I understand how normal variables and pointers are represented in memory.

    For example, it's easy to understand that a pointer Ptr will have one address, and its value will be a...
  6. Replies
    3
    Views
    24,983

    This makes things better indeed. Thanks

    This makes things better indeed. Thanks
  7. Replies
    3
    Views
    24,983

    How To Create Database Tables in C

    I need to code a small/simple database application using C.

    My idea is to use a B-Tree to store the items of each table. The problem I am facing is that tables need to be flexible to hold an...
  8. Feedback on My Idea for a New Obfuscated C Contest

    As you probably know, there used to be an "International Obfuscated C Code Contest", where the goal was to explore the subtleties of the C language by seeing who could write the most obfuscated code....
  9. Replies
    5
    Views
    5,974

    Ops. Sorry about that. Just to help other...

    Ops. Sorry about that.

    Just to help other people coming to this thread, yeah it seems that what I asked is indeed undefined behavior.
  10. Replies
    5
    Views
    5,974

    Is x=x++; Undefined Behavior?

    The output of the following code:


    x = 10;
    x = x++;
    printf("%d\n",x);

    is 11.

    What is not clear to me is: does the increment on x happen before or after the attribution? And is this...
  11. That fixed it. Thanks a lot.

    That fixed it.

    Thanks a lot.
  12. Problems Reading Line With Unknown Number of Integers

    I need to read a file via stdin (so I'll run my program as ./program <input.txt> output.txt) but I am having problems doing so correctly. The input file starts with an integer x, and x lines follow....
  13. @iMalc, good points, and it made things more...

    @iMalc, good points, and it made things more clear.

    Thanks.
  14. Curiously the trick works when using ANSI...

    Curiously the trick works when using ANSI standard as well.

    But yeah doesn't work when the array is not last member.
  15. Increasing The Size of Memory Allocated to a Struct via Malloc

    Hi,

    I just learned that it's possible to increase the size of the memory you'll allocate to a struct when using the malloc function. For example, you can have a struct like this:


    struct test{...
  16. Replies
    2
    Views
    930

    Worked like a charm. I forget scanf returns the...

    Worked like a charm. I forget scanf returns the number of items successful matched.

    Thanks a lot.
  17. Replies
    2
    Views
    930

    Problems Reading Input from a File

    Hi,

    My program needs to read input from a file called file.in, and I need to do it by adding the file as an argument when running the program. So I run it like this:


    ./myProgram <file.in>...
  18. Gotcha now. Thanks

    Gotcha now.

    Thanks
  19. The fact that you should not include libraries...

    The fact that you should not include libraries you don't need is pretty obvious to me.

    What I am asking is where to place the ones you do need, because there are several ways to do it (I mentioned...
  20. I don't mean that, and yeah I know that you...

    I don't mean that, and yeah I know that you shouldn't put function calls or definitions inside a header file. If you read my first post you'll notice that I said functions go inside the functions.c...
  21. Where Should I Put Header Calls When Using Multiple Files?

    Suppose I am working on a program with 3 files:


    Main.c (main file which runs the program)
    Functions.c (collection of functions used by main.c)
    MyHeader.h (list of function prototypes,...
  22. Thanks. I suspected, but better to cross check...

    Thanks. I suspected, but better to cross check with the pros.
  23. Is the type cast necessary when using malloc in C?

    I am learning how to use malloc, and I am seeing that most people think it's necessary to make a type cast when passing the memory address to the pointer. For example, here's a code to get 16 new...
  24. Replies
    2
    Views
    16,888

    I did read the documentation as stated in my...

    I did read the documentation as stated in my first post, but I couldn't figure out how to apply that.

    I managed to install the library using the Synaptics manager.

    Thanks anyway.
  25. Replies
    2
    Views
    16,888

    How To Install A New C Library on Linux

    First of all sorry for the newbie question, but here we go:

    I am trying to install the GMP (GNU Multiple Precision Arithmetic) Library on my Ubuntu machine.

    I downloaded the .tar.bz2 file, and...
Results 1 to 25 of 33
Page 1 of 2 1 2