Thread: Declaring

  1. #1
    C Beginner
    Join Date
    Dec 2011
    Location
    Portugal
    Posts
    187

    Declaring

    Hey guys, I'm having a few problems declaring a few variables.

    Thing is I'm passing "vertices" as a parameter for a function like this :

    Code:
    void leadj (char doc[50],int vertices)
    What happens is when reading doc, I'm able to reach the value of vertices.
    How can I declare the value I get from the doc to vertices ?

    Thanks, Dean.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by DeanWinchester
    What happens is when reading doc, I'm able to reach the value of vertices.
    Sounds like you are just accessing the array out of bounds. The cure: don't do that.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    I don't understand what you are asking. It would help if you tell us what is going wrong.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  4. #4
    C Beginner
    Join Date
    Dec 2011
    Location
    Portugal
    Posts
    187
    I got it fixed now, thanks for helping anyway!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error on declaring int
    By karipap in forum C Programming
    Replies: 3
    Last Post: 05-03-2009, 06:42 PM
  2. Declaring a pointer, int *ptr vs int ptr
    By thetinman in forum C++ Programming
    Replies: 2
    Last Post: 12-01-2006, 02:39 PM
  3. Declaring variables
    By Marlon in forum C++ Programming
    Replies: 6
    Last Post: 06-21-2005, 04:16 AM
  4. need help declaring an msg
    By kwm32 in forum Windows Programming
    Replies: 6
    Last Post: 03-24-2004, 02:49 PM
  5. declaring a new type
    By c programming in forum C Programming
    Replies: 2
    Last Post: 11-19-2002, 12:31 PM