| | |
How do I use an array of structures?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2005
Posts: 6
Reputation:
Solved Threads: 0
When I wrote this program with a structures. I said:
Is this a right way of defining it? And how do I get the program to use the next structure every time?
I have another question. How do I Modify a file? I want to know how to do only a certain part of it like a certain structure?
C++ Syntax (Toggle Plain Text)
{ struct Contact { char Name[101]; char Middle[101]; char Last[101]; long Area; long Area1; long Area2; long Area3; long Home; long Business; long Cell; long Other; char Email[101]; char Address[101]; int Zip; char City[101]; char State[101]; char Country[101]; char Job[101]; char Company[101]; }; Contact hi[100];
Is this a right way of defining it? And how do I get the program to use the next structure every time?
I have another question. How do I Modify a file? I want to know how to do only a certain part of it like a certain structure?
i usually use typedef and pointers with structs.
for file access use fopen(const char *, const char *)
for file access use fopen(const char *, const char *)
hmm blunt.
Your right I like C and I don't like C++. I presumed it wouldn't compile in C++ too. But your right it does.
However, it also compiles with the struct keyword in C++ and fopen is available in C++.
Your right I like C and I don't like C++. I presumed it wouldn't compile in C++ too. But your right it does.
However, it also compiles with the struct keyword in C++ and fopen is available in C++.
>However, it also compiles with the struct keyword in C++ and fopen is available in C++.
Yes it does, but then again, so does malloc, and nobody in their right mind would advocate malloc in C++ most of the time. There are broad differences between good C and good C++, and using C solutions in C++ would be limiting yourself unnecessarily.
Yes it does, but then again, so does malloc, and nobody in their right mind would advocate malloc in C++ most of the time. There are broad differences between good C and good C++, and using C solutions in C++ would be limiting yourself unnecessarily.
I'm here to prove you wrong.
![]() |
Similar Threads
- Error with array structures :( (C++)
- array of structures within a struct (C++)
- Dynamic Array of Structures, Loop problem! (C++)
- Creating dynamic array structures (C++)
- Passing array of structures into a function (C++)
- Input Output File Streams - Sorting Help With Array (C++)
- struct array and enum problems (C++)
- dynamic array of structures problem (C++)
Other Threads in the C++ Forum
- Previous Thread: C++ question and some guidance
- Next Thread: Problem with Character Arrays
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






