Search:

Type: Posts; User: livin

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    13
    Views
    1,782

    may be u should look up the Arithmetic operators...

    may be u should look up the Arithmetic operators in C section of the book.

    C - Overview of Operator Types, Arithmetic, Bitwise, Assignment, Precedence Table

    when u do x % y, u get the...
  2. Replies
    13
    Views
    1,782

    Do you need to save the reversed number or print...

    Do you need to save the reversed number or print it to screen?

    If it is just printing out the reverse, I would just repetedly do a number % 10 and print it out. If you need to save it, I would do...
  3. Hmm interesting. So u cannot delete an array with...

    Hmm interesting. So u cannot delete an array with delete() ? I tried delete [] student_details and it worked. I am also learning c++ after learning c. So I thought all free() translate to delete()...
  4. seg fault while deteting the dynamically allocated memory

    Heres the piece of code I wrote to gather student details into a dynamically allocated array of structs. But when I try to delete the memory, it gives me a seg fault. I used print statements to make...
  5. Replies
    6
    Views
    1,094

    Thanks a lot..that helped.

    Thanks a lot..that helped.
  6. Replies
    6
    Views
    1,094

    multi file programs and structs

    Hi,
    I am trying to work on my first cpp assignment which requires me to break the code into multiple files. I also have to work with structures. I am a little confused as to where my struct...
  7. Yes the above reply is correct. On a more general...

    Yes the above reply is correct. On a more general level, u need to either define the function before you use it or declare it before using it in main and define it after main.
  8. Replies
    0
    Views
    1,817

    Need help with the numa migration code

    Hi ,
    here is the code I am trying to get running on my linux system. I emulated NUMA on my laptop using the numa=fake=2 boot time option. The source code is from the documentation I found...
  9. Replies
    11
    Views
    2,137

    What it means is that u cannot rearrange the...

    What it means is that u cannot rearrange the characters of a string when u declare it as a constant like char *str = "some_string". U can however rearrange the characters when u save the string as an...
  10. Replies
    4
    Views
    1,017

    Yes u are right. I think it was an overseen error...

    Yes u are right. I think it was an overseen error as a result of an unchecked keystroke in vim. But the actual code had a pointer declared.
    Thank you oogabooga. I think that will work. I thought all...
  11. Replies
    4
    Views
    1,017

    help with pointers

    Hi,
    I need help with this program . I am doing something wrong with pointer addition.





    /* program allocates 16 MB of memory on heap and writes to every 2MB interval*/

    #include...
  12. Replies
    3
    Views
    1,085

    yeah I saw that..but I couldn't find anything abt...

    yeah I saw that..but I couldn't find anything abt how to use it right. Could you see some obvious solutions I can try?
  13. Replies
    3
    Views
    1,085

    Need help with write function

    Hi,
    I wrote this small piece of code to test the effect of O_DIRECT flag. But for some strange reason the program fails at the write function line with invalid argument. I cant seem to...
  14. Replies
    13
    Views
    13,848

    iMalc, I dont think allocating bytes+1 is the...

    iMalc, I dont think allocating bytes+1 is the right size. Each page is represented using the last bit of a byte. So I would just be needing as mnay bytes as the pages available. That is why i...
  15. Replies
    13
    Views
    13,848

    k thanks I did that. but removing the (void *) is...

    k thanks I did that. but removing the (void *) is warning me that I am comparing a pointer to an interger. I think (void *) is necessary too. But the actual problem comes when I am freeing the...
  16. Replies
    13
    Views
    13,848

    Hi guys. Sorry for the late response. The code...

    Hi guys. Sorry for the late response. The code was in my laptop and I had to wait till I go home to fetch it. Its part of a bigger shared project. What I am trying to do here is trying to get a...
  17. Replies
    13
    Views
    13,848

    free(): invalid next size (fast)

    Hi,
    I need help with this snippet of code which breaks down at the free() line.




    /* called function */
    unsigned char* func(){
    unsigned long length = 9;
    unsigned char *p = NULL;
  18. Replies
    4
    Views
    1,007

    Thank you all. I was almost convinced I had some...

    Thank you all. I was almost convinced I had some basic concepts missing. Now it makes sense.
  19. Replies
    4
    Views
    1,007

    Question on C syntax

    hi,
    I came across this code online on a tutorial site. This part of the code confused me.



    /*
    * parse--split the command in buf into
    * individual arguments.
    */...
  20. Replies
    2
    Views
    1,255

    Need help with file_copy program

    Hi,
    I wrote this simple file copy program to copy contents from input to output file. The program kind of rins into an infinite loop at read/write stage. Can anyone please point out where I am...
  21. Replies
    3
    Views
    18,057

    oh ok. I included the unistd.h and it worked....

    oh ok. I included the unistd.h and it worked. thanks you two!
  22. Replies
    3
    Views
    18,057

    implicit declaration of function ‘close’

    Hi,
    I wrote a simple piece of code as an exercise in file_descriptors which opens a file and then closes it using open and close. When I try to compile it using the flags -Wall -ansi...
  23. Replies
    6
    Views
    1,174

    Wonderful explanation..thanks a lot.

    Wonderful explanation..thanks a lot.
  24. Replies
    6
    Views
    1,174

    Ok I think I got what u mean when u said u can do...

    Ok I think I got what u mean when u said u can do arithmetic on pointers. But in the line



    I know ptr points to the second element of p which is itself a pointer to an array of integers, arr....
  25. Replies
    6
    Views
    1,174

    I have a slight confusion on the output of first...

    I have a slight confusion on the output of first printf

    when we say *prt-arr, *ptr is a pointer to int and hence holds an address. when we do *ptr - arr, we are subtracting an array arr form...
Results 1 to 25 of 45
Page 1 of 2 1 2