Search:

Type: Posts; User: lazyme

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    2,384

    Avoid memory leak

    I have written a simple C function to convert a string to an integer.




    char* inttostr(int num)
    {
    char buf[10];
    int i = 0;
    int j = 0;
  2. Replies
    4
    Views
    1,370

    Ok thanks this works. I assumed that since I had...

    Ok thanks this works. I assumed that since I had brackets around the post-incr and post-decr operators, it would happen before the recursive call.

    Thanks again anduril462 and itsme86
  3. Replies
    4
    Views
    1,370

    a question about recursion

    I wrote a recursive function to find if a given string is a palindrome


    #include <stdio.h>

    int isPalindromeRec(char *start, char* end);

    int main()
    {
    char str[] = "abccba";
  4. Replies
    0
    Views
    801

    CreateProcess() query

    I am aware of the CreateProcess use to launch a new process. I want to know if I could use it in a situation like this

    1. I want to launch the windows command prompt(cmd.exe) and run a batch file...
  5. Replies
    0
    Views
    3,402

    reversing individual words in a sentence

    Hi ,

    I have written a piece of code to reverse a sentence by reversing individual words at a time..
    I have tried it and it works fine.


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

    void...
  6. Replies
    10
    Views
    7,620

    The delete works fine now for every node other...

    The delete works fine now for every node other than the last node in the tree. Even for the last node, the node is deleted however the memory pointed to by the rootNode struct is freed.

    For the...
  7. Replies
    10
    Views
    7,620

    ^^ Thanks for pointing out the mistake. The...

    ^^
    Thanks for pointing out the mistake. The delete works just fine now.


    else if( (*nodeToDelete)->leftChild == NULL )
    {
    tempNode = (*nodeToDelete)->rightChild;
    (*nodeToDelete)->data =...
  8. Replies
    10
    Views
    7,620

    I found there was an error with my relinking and...

    I found there was an error with my relinking and the nodes with one children were not getting relinked at all.

    I managed to fix some bugs and the delete works fine now for nodes with 1 child and 2...
  9. Replies
    10
    Views
    7,620

    Help with delete - Binary search tree

    I need help with the delete operation on a binary search tree. The delete operation works fine for leaf nodes and nodes with one child. However, it does not work fine with nodes with 2 childs.
    ...
  10. Replies
    9
    Views
    24,888

    @claudiu and Adak - Thanks. I will look into it....

    @claudiu and Adak - Thanks. I will look into it.

    @brewbuck - My array width and height are both always in powers of two. What is the bit manipulation trick I can use?

    Thanks
  11. Replies
    9
    Views
    24,888

    ^^ I will take care of the printfs and the...

    ^^
    I will take care of the printfs and the variable names. I used the printfs just for debugging and would not be a part of my final code.

    I cannot hard code the order array as my final code wont...
  12. Replies
    9
    Views
    24,888

    zigzag traverse a matrix

    I want to traverse a matrix in zig-zag fashion.

    Say my matrix is


    a11 a12 a13 a14
    a21 a22 a23 a24
    a31 a32 a33 a34
    a41 a42 a43 a44
  13. Replies
    4
    Views
    1,958

    Ok. That works. Thanks

    Ok. That works.
    Thanks
  14. Replies
    4
    Views
    1,958

    String reverse problem

    I wrote a simple program to reverse a string in C.

    I am getting an exception on running it. Heres my code


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

    void reverse(char*);
  15. Replies
    3
    Views
    1,808

    Please help me optimize my code

    I have written a simple code to practice some basics of c++ and some file handling. Haven't really used any of the OOP features. The program should open the input file and read each individual number...
  16. Ok. What do you suggest me to change? Is my...

    Ok.

    What do you suggest me to change? Is my for loop flawed?
    This is the best way I could think of implementing it.
  17. Turns out there was no problem with the code. I...

    Turns out there was no problem with the code. I was doing addToQueue(time4) twice hence the problem :|

    Sorry MK27 my stupid goof up wasted your time.
  18. I am just trying to test my addToQueue function...

    I am just trying to test my addToQueue function by passing time values in random order.

    I agree that I can get the same timestamp in two successive calls and will have to handle it. Thanks for the...
  19. Problem implementing priority queue using array

    Hi,

    I am trying to implement a priority queue of unsigned ints(timestamps) using array.

    Here is what my code looks like.

    The GetCurrTime returns time in microseconds


    unsigned int...
  20. Replies
    2
    Views
    3,639

    Learning OS programming using Nachos

    I want to learn OS programming in C++ and found by searching the forums that Nachos is the best place to start.

    I am looking for resources that would help me get started quickly. Anyone knows a...
  21. Replies
    16
    Views
    3,337

    Here's one way to swap 2 integer variables a and...

    Here's one way to swap 2 integer variables a and b.


    a= a+b
    b= a-b
    a= a-b
  22. Replies
    15
    Views
    4,551

    Thanks anon. You have helped me optimize my code...

    Thanks anon. You have helped me optimize my code quite a lot and it looks much better now.
  23. Replies
    15
    Views
    4,551

    Thanks anon. I have written my code around this...

    Thanks anon. I have written my code around this and it works fine. The structure contains 13 elements now.

    I am posting my complete code below. Please let me know if you can foresee any...
  24. Replies
    15
    Views
    4,551

    I want set_difference to determine the items are...

    I want set_difference to determine the items are same only if all the four fields match.

    Can I achieve this with


    bool operator< (const ps_report_rows& lhv, const ps_report_rows& rhv)
    {
    ...
  25. Replies
    15
    Views
    4,551

    No, I don't have the operator < defined. I...

    No, I don't have the operator < defined.

    I dont necessarily need to compare more than one field in the struct. Can I use set_difference if my lists are sorted by any field in the struct?
Results 1 to 25 of 53
Page 1 of 3 1 2 3