Discuss Question about structures :) in the C Programming forum on Dev Shed. Question about structures :) C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
Posts: 7
Time spent in forums: 55 m 28 sec
Reputation Power: 0
Question about structures :)
Can I ask is there a way to access two or more variables inside a structure
an example is that I would like to access a coordinate x and y and a value in a structure is there a way I could access them at the same time to access their value
Ps : their value is already declared I need to know how to access them
Posts: 6,141
Time spent in forums: 2 Months 2 Weeks 3 Days 23 h 52 m 21 sec
Reputation Power: 1974
Accessing each individual struct field is trivial.
Extremely trivial!
But our answers do not satisfy you. Which tells us that you are not asking the right question.
Over 30 years ago, British writer Douglas Adams wrote a science-fiction spoof, "The Hitchhiker's Guide to the Galaxy". In that story, the most powerful computer ever built, Deep Thought, was given the task of coming up with the Ultimate Answer to Life, the Universe, and Everything. Millions of years later, it came up with the answer: 42. Well, of course the Ultimate Answer had no meaning unless you knew the Ultimate Question, which Deep Thought was incapable of, but it could design the computer that could come up with the Ultimate Question, and it would incorporate biological matrices in its computation, and it would be called "The Earth". And five minutes before final printout, it was destroyed to make way for a hyper-spatial bypass (like a freeway junction).
All of which is a way of saying that you are not asking the right question. We know the answer, but we don't understand the question.
Is there some special way in which the data is being encrypted or formatted?
Posts: 3,389
Time spent in forums: 1 Month 2 Weeks 3 Days 14 h 22 m 25 sec
Reputation Power: 383
Glossary
"file" data in long term storage accessible through the file system.
".map file" any sort of file, often associated as an intermediate program linker file.
".o file" any sort of file, usually the object file created by a compiler on a unix system.
Quote:
everything is encoded in a .o file
Maybe you just need to write a main function which you link to the .o file? The project is a little tricky without documentation, but I have some friends in Russia...
What is the relationship between your .map file and the struct map ???
This gawk program prints the first character of the second line of input files
gawk -F '' '2==FNR{print $1}'
Are x and y in your structure the column and row of data from your file, and the value member equal to the numerical value of the character in the file? And do you need an array of arrays of these structures? And if so, why bother storing x and y? (Yes, you might need them.)
Last edited by b49P23TIvg : October 15th, 2012 at 09:28 AM.