vividexstance's Profile User Rating: *****

Reputation: 659 Enlightened
Group:
Expert
Active Posts:
2,272 (1.68 per day)
Joined:
31-December 10
Profile Views:
11,163
Last Active:
User is offline Today, 08:24 AM
Currently:
Offline

Previous Fields

Country:
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:
0
Expert In:
C/C++

Latest Visitors

Icon   vividexstance has not set their status

Posts I've Made

  1. In Topic: Help with C Programming question on Sum of prime factors

    Posted 16 Sep 2014

    One thing I notice right off the bat, is that when checking if a number is prime, you don't need to check every number up to the given number. You only need to check up to half of the given number half of the square root number. So for say, 20, you only need to check up to 10. This will make your checking more efficient.

    Thanks CTphpnwb for pointing that out, not sure why I thought it was the other way.
  2. In Topic: C++ Help!

    Posted 16 Sep 2014

    The problem's description, especially:

    Quote

    HINT: You do not need any strings. You need one while loop and two for loops. <cctype>

    Makes it sound like you just need to read single characters until you reach the end of the line, typically the newline character. Also, right after you read in a character, you can use the functions from cctype to determine what type of character you read. For example, there is the isspace() and ispunct() functions. Both of them take a character as an argument and return true or false depending on what the character is.
  3. In Topic: C++ Asterisk diamod with even numbers help

    Posted 16 Sep 2014

    If you're getting a "one-off" error, then you should look at your loops. The "less-than-or-equal-to" operator might be causing your problem. Try using just the "less-than" operator.

    View Postinfernorthor, on 15 September 2014 - 11:35 PM, said:

    try using a better variable
    int span = //something
    for( int i=-span; i<=span; i++ ) {
        for( int j=-span; j<=span; j++){
            ....
        }
    }
    
    

    How is the NAME of a variable affecting how the program runs? Or was that a sarcastic comment?
  4. In Topic: Using pointer of pointers in a stack program.

    Posted 16 Sep 2014

    View Postdenormal, on 15 September 2014 - 06:30 PM, said:

    Also, just to reiterate my original reasoning. I was just trying to explain why you might use a pointer to a pointer in the context of the OP's problem. It seems to me that his push and pop routines wanted to take the address of a pointer so that pointer can be modified, which the OP seemed confused about.

    Like baavgai already stated, a pointer is a type in C. If you take the address of a pointer, that's just a pointer to a type. By bringing in the double pointer, as you call it, is just confusing the issue.

    If the purpose of a function is to take a pointer and somehow change it, then that function should return this "changed" pointer, similar to how the C-style string functions from <string.h> work. Most of those functions return a pointer, like strcpy().
  5. In Topic: Using pointer of pointers in a stack program.

    Posted 15 Sep 2014

    View Postinfernorthor, on 15 September 2014 - 12:03 PM, said:

    Not to derail the conversation, but he didn't pass a pointer to a pointer. It is a double pointer. Thus being pass by reference.

    There is no such thing as references in C, which is the language the OP is using. This:
    T**
    

    Is a pointer to a pointer of type T. You can call it a double pointer, but its still a pointer to a pointer.

My Information

Member Title:
D.I.C Lover
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Comments

Page 1 of 1
  1. Photo

    orihotomihsah Icon

    09 Sep 2013 - 09:45
    Hi
Page 1 of 1