Salem_c's Profile User Rating: ****-

Reputation: 1657 Grandmaster
Active Posts:
3,136 (2.01 per day)
30-May 10
Profile Views:
Last Active:
User is offline Today, 02:39 PM

Previous Fields

Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
Icon   Salem_c has not set their status

Posts I've Made

  1. In Topic: Also Fibonacci Squence in C++ Array Reverse

    Posted 2 Sep 2014

    Start with
    int FibArray[MAX] = { 0 };
    so you have a properly initialised array.

    Next, only print the array AFTER you have done all the calculations. You're printing the whole array (junk and all), every time around the loop doing the calculation.
  2. In Topic: unique_ptr and arrays

    Posted 2 Sep 2014

    The implementation isn't required to diagnose every programming error at the point of origin (of the error). The lack of a crash is not (nor can ever be) an argument for the correctness of the code.

    Very often though, you'll find that the crash has just been deferred to some later point in the code - where it will be that much harder to solve.
  3. In Topic: Type casting difference

    Posted 2 Sep 2014

  4. In Topic: String

    Posted 1 Sep 2014

    1. Is this C or C++ (noting that one of your other threads is pure C++, and the other is some bastardised mix of C and C++).

    2. Do you have a mix of string constants, statically allocated arrays and dynamically allocated memory?

    3. What sort of operations are you going to perform on the completed strings u and v? strlen / strcat / strcmp / others?

    > Imagine I had a string at memory location &s (not null terminated)
    > and another string at memory location z (null terminated).
    Don't lay pointless restrictions on our implementation suggestions.

    If you want a reasonably efficient implementation, then all the string fragments should have the same properties (eg. /0 terminated in malloc'ed memory). The more permutations you allow, the messier it all becomes. Start with one useful case and make sure the idea works before trying to optimise it further.
  5. In Topic: Explaination required

    Posted 1 Sep 2014

    Here are some things to do.

    1. Decide whether this is C or C++. You've included all C++ headers, but there is precious little which is C++ specific.

    2. Run the code with a variety of inputs to get the feel for what it does.

    3. Go through the code and replace all instances of that silly forn macro with proper code.

    4. Go through the code and try and figure out what each variable is for. If it seems to be something important, then give it a better name (in place of all those meaningless single letter identifiers).

My Information

Member Title:
void main'ers are DOOMED
Age Unknown
Birthday Unknown
Programming Languages:
C, C++, Perl, awk, various assemblers

Contact Information



Page 1 of 1
  1. Photo

    fromTheSprawl Icon

    07 Sep 2012 - 02:38
    Please read my thread. I kid! Just want to say your forum avatar is awesome. ^^
  2. Photo

    Salem_c Icon

    26 Dec 2010 - 01:36
    Do not PM me for 1:1 support, or to try to get me to read your threads.
Page 1 of 1