Click here to Skip to main content
15,890,123 members
Everything / Struct

Struct

struct

Great Reads

by honey the codewitch
BinaryReader needs a better way to read strings and types. Here's a quick and dirty fix
by Member 13797506
Introduction to structs (value types) in Java
by ASP.NET Community
What is Access Modifier?Objects in .NET are created from a class, struct, etc.  Thesedefinitions, as well as the properties, methods, or events
by Alex the Green Apple
C library defining string type and string manipulation functions

Latest Articles

by honey the codewitch
BinaryReader needs a better way to read strings and types. Here's a quick and dirty fix
by honey the codewitch
How to marshal structs that the .NET marshaller just can't handle without a lot of help
by Member 13797506
Introduction to structs (value types) in Java
by Alex the Green Apple
C library defining string type and string manipulation functions

All Articles

Sort by Score

Struct 

23 Apr 2021 by honey the codewitch
BinaryReader needs a better way to read strings and types. Here's a quick and dirty fix
15 Apr 2013 by OriginalGriff
It has "advantages" if you are going to include the same data in a number of different structures, and want to declare the common data in a single place - but generally speaking that is a poor way to do things anyway.The only real "use" of this is when you want to define a set of related...
18 Mar 2015 by OriginalGriff
What shock? It does what I would expect.eYour xevents is a struct - which means that it's a valuetype.It contains an array of ytimeframe ojbects, which because it's an array is a reference type, regardless of the type of the objects it is an array of.So when you do this:for (i = 1; i
19 Sep 2021 by Rick York
Start by reading the documentation : vector::resize at C++ Reference[^] transform at C++ Reference[^] It is called there to make sure holdresult has the same number of items that myvec2 does. If it doesn't then transform will not be able to...
20 Feb 2019 by k5054
Overlooking the fact that the code you've provided won't compile at all ... Your function course() returns a struct, but that doesn't get assigned in the little bit of main() you've provided. Going back to basics - suppose we have a function f that takes an int as an argument, and returns an...
20 Feb 2019 by Stefan_Lang
Although solution 1 is essentially correct, this is what I would change, to make your code not only work, but work well: struct Credit course(...) // leave this function as is ... struct Intermediate grade(struct Credit& credit) { //pass by reference! ... // leave the function code as is } int...
3 Nov 2020 by Richard MacCutchan
You are trying to pass a vector reference to the printData function, so you should use the correct declaration: void printData(vector& collection); Also in your printData function you are trying to print 5 entries, but the...
4 Aug 2021 by CPallini
If you add night (i.e. this->) with input then ther is a type mismatch, because the former is a int while the latter is a myint. That said, I would rewrite it this way #include using namespace std; struct myint { private: int...
15 Oct 2012 by n.podbielski
Structures cannot have unitialized members.Classes can.Structures also have default constructor added by compiler so when you adding :this() as default constructor call, error with message that struct cannot haveuninitialized members disapper as default constructor will assign default...
10 Apr 2013 by nv3
With the array syntax in the argument list of AddGymnast you are making things hard onto yourself. Tryvoid AddGymnast (Gymnast *gymnast, Credentials *credentials){ puts ("Pais: "); gymnast->cred = credentials; gets (credentials->country); puts ("\n"); printf...
10 Apr 2013 by CPallini
I fixed the syntax error in the code below#include #include struct SCredentials{ char name[30]; char country[20];};typedef struct SCredentials Credentials;struct SGymnast{ char sport[20]; int nMedals[3]; Credentials *...
10 Apr 2013 by Matthew Faithfull
Several things to note so that you can work it out. If you're sticking to C although I have no idea why you would, then pass arrays as pointers to pointers.void AddGymnast( Gymnast** gymnast, Credentials** credentials, int pos )...Instead of trying to read data directly from the...
30 Nov 2013 by OriginalGriff
Data alignment is the simple answer.A char is a single byte, so it can be aligned on an odd or an even byte boundary - the address of the character can be odd or even.Generally speaking any datatype which is not byte long needs to be aligned on an even address (or longer depending on the...
14 Jan 2014 by CPallini
If you have a fixed number of users (say 10) then declare#define USERS 10struct mine_struct *p[USERS];and then, at runtime, create and fill the details of proper item, e.g.if (user == 5){ p[user] =(struct mine_struct *) malloc(sizeof(struct mine_struct)); if (p[user]) ...
9 Nov 2014 by Sergey Alexandrovich Kryukov
This is because iVum is private (default); to be accessible, it should be internal or public.Your code and post look as if you tried to write some application before reading a manual on the language and platform. Such approach is counter-productive.—SA
19 Jun 2015 by Sergey Alexandrovich Kryukov
First, write forward declaration of one of the struct, then fully define the other struct below, and, finally, fully define the first structure represented by the forward declaration above. The C syntax is pretty awkward; please...
20 Jun 2016 by KarstenK
To achieve your own sort order you must overwrite the sorting algorithm, by overwriting the comparison operator "
2 Jan 2018 by Rick York
Here is how initialize the structure : struct str { char arr1[4]; // this string is limited to three characters plus null char arr2[4]; int num1[4]; int num2[4]; }; struct str select = { "Sam", "Joe", { 0, 1, 2, 3 },...
11 Mar 2022 by CPallini
typename does the trick, try //.. typename List::node* currentL1 = L1.first; typename List::node* currentL2 = L2.first; // ..
11 Mar 2022 by k5054
CPalini's solution is correct, but maybe in modern C++, rather than trying to puzzle out what a variable's type should be, one can use auto instead e.g.auto * currentL1 = L1.first;
10 Sep 2023 by merano99
double p; int* S = malloc(n * sizeof(int)); p = (tr[i].a + tr[i].b + tr[i].c) / 2.0; S[i] = sqrt(p * (p - tr[i].a) * (p - tr[i].b) * (p - tr[i].c)); When assigning p, an arithmetic overflow can occur, since initially only int is...
15 Oct 2012 by FourCrate
When I try to type all this out for a struct/structure without the bits in bold, I am getting squiggly error lines. Why is it that when I add the :this() to the code, the squiggly lines disappear? This error doesn't appear for classes but they will for structs. struct Line { ...
31 Oct 2012 by OriginalGriff
There is an example here: (You may have to tweak it a bit for your exact structure)http://stackoverflow.com/questions/2871/reading-a-c-c-data-structure-in-c-sharp-from-a-byte-array[^]
30 Nov 2013 by Morbiddeath
I have a structure to represent the ARP (address resolution protocol) but the bytes in memory are misaligned, its a 64 bit capable processor running 32 bit OS.The structure is 28 byte and is as follows:ARP structure: unsigned short hardware; //could use USHORT but like it...
19 Jun 2015 by CPallini
Sergey already gave you the correct answer, I just add an example:File a.h #ifndef __A_H__ #define __A_H__ struct A; // forward declaration of A struct B { struct A * element; }; #endif // __A_H__File b.h #ifndef __B_H__ #define __B_H__ struct B; // forward declaration of...
8 Apr 2016 by nv3
I am not sure that I understand your question correctly. The problem you are facing is that all your messages have a common header and then some type-specific part. And to send them you want both of these parts in a contiguous buffer. I guess you have two options here:(1) Include the header...
15 Apr 2017 by OriginalGriff
Well no, it won't. It only checks the element after the one you just inserted to see if that is the same as the one you just stuck in there! If you want to check then you are going about it the wrong way: check that the ID doesn't exist before you put it in there! Start by writing a method to...
25 Feb 2018 by phil.o
To generate a random number either 1 or 2, you can use the following code: #include int random_number = (rand() % 2) + 1; Hope this helps.
25 Apr 2018 by Jochen Arndt
Your sprintf() calls are outside of any function. You have to move them into a function (using main() here): int main() { sprintf(men[0].n[0],"hello1"); sprintf(men[1].n[1],"hello2"); sprintf(men[2].n[2],"hello3"); printf(" %s",men[1].n[1]); return 0; }
27 Apr 2018 by Member 13797506
Introduction to structs (value types) in Java
28 Apr 2018 by OriginalGriff
How big is the array a in the tt struct? How many elements of that array do you use? That isn't your problem, but it's a "future problem" that you need to take care of. As far as I can see, your code does what you describe it as "should be doing": arr = 4 arr = 5 arr = 6 arr = 7 arr = 1 ...
28 Apr 2018 by Patrice T
Quote: I'm trying to replace the min value in an array in the max value, I have an issue with the output. This is not what your code is doing. Your code is replacing minimums while you are searching minimum and maximum. Your code need to search minimum and maximum, and when they are known,...
10 May 2018 by CPallini
You need pointers. Let's try a simple example #include typedef struct { int x, y; } Point; void doubleIt( Point * p ) { p->x = p->x * 2; p->y = p->y * 2; } void printIt( const Point * p) { printf("{%d, %d}\n", p->x, p->y); } int main() { Point p1, p2; Point pa[4]; int...
11 Jul 2018 by OriginalGriff
As I told you yesterday: Error C++ struct with pointer[^] THOSE AREN'T POINTERS. struct test { int next; int previous; int value = 0; }; next and previous cannot be declared as int - they need top be pointer values and preferably pointers to the actual destination type: struct test { ...
19 Nov 2018 by CPallini
There are many mistakes in you code. Did you possibly meant #include struct Count { //My struct int intOne; int intTwo; }; void printCode(struct Count numbers) { printf("%i%i\n", numbers.intOne, numbers.intTwo); } void printNumbers() { struct Count numbers = {0}; int...
8 Dec 2018 by CPallini
You program is badly organized, with useless harmful recursive calls, calls to main, global variables. In order to get proper help you should show us the code of the main function. [update] Try the following program (please note, you should always check the return value of the scanf function,...
29 Dec 2018 by OriginalGriff
Not a good idea, not at all. Yes you can do it, provided the two child classes are in separate files. But ... it's a very bad idea as the two structs may have different "physical" sizes (in this case, they don't, since the first one will be "rounded up" to a multiple of 32 bits anyway). And when...
15 Oct 2020 by Richard MacCutchan
That syntax is in a later version of the compiler than the one provided by VS2008. You should upgrade to VS2019.
3 Nov 2020 by Joe Woodbury
In addition to Richard's solution, I'd: 1) make collection const. void printData(const vector& collection); 2) Iterate the collection using: for (const auto& item : collection) 3) Add void print() const method to CD_TYPE. 4) Use...
3 Nov 2020 by CPallini
You could also overload the insertion operator ...
11 Dec 2020 by Rick York
This is structured incorrectly, pun intended. fgets reads one line from a file : fgets - C++ Reference[^]. Car should not be a separate structure. It should be part of human since there is no more data for it other than the model. The bigger...
4 Mar 2021 by Richard MacCutchan
Structure types - C# reference | Microsoft Docs[^]. Arrays - C# Programming Guide | Microsoft Docs[^]. So once you have defined your struct and its members you can create the individual instances of it. And each instance you create needs to be...
4 Mar 2021 by OriginalGriff
Using an array of struct items is exactly the same as using an array of class items, with a few exceptions. You declare it the same way: myStruct[] array = new myStruct[10]; But because all struct items are value types rather than reference...
26 Apr 2021 by OriginalGriff
You have declared an array of occurrence objects called occurrences: struct occurrence occurrences[30]; So all you need is an index to the next free one, and get the address of it using: struct occurrence *occ = &(occurrences[indexToNextFree++]);...
19 Sep 2021 by Mladen Janković
Dereferencing iterator of std::map gives you reference to key-value pair: std::pair therefore it's also the type a callable you provide to std::find_if must accept. In your example findifdouble callable...
29 Oct 2021 by deXo-fan
Hello, I've noticed that whenever you write a program in Visual Studio that uses structs (or classes), the assembly code generated doesn't contain a single MASM STRUCTURE, even though it would perfectly fine. Instead, VC++ does something I...
26 Oct 2021 by den2k88
Assembly does not have structs. MASM does but it is its own interpretation of Assembly. Indeed the name itself means Macro ASseMbler and STRUCT is one of these macros, provided to help the developers. This kind of additional keywords is normal...
24 Feb 2023 by CPallini
That is how bubble sort works, see, for instance this page: Bubble sort in C | Programming Simplified[^]. Such code, however, is flawed. For instance, when swapping triangles it doesn't swaps the triangle areas as well. Moreover it performs...
10 Sep 2023 by Rick York
If I were you I would write some functions and macros to simplify the code and make it easier to read. Here are some that come to mind : double GetArea( triangle * pt ) { double p, area; p = ( pt->a + pt->b + pt->c ) / 2.0; area = sqrt(...
30 Oct 2012 by Tarun Batra
i have a global structure like this :-typedef struct MachineList{ BSTR AccountId; BSTR MachineId; BSTR Make; char* Make1; BSTR Model; char* Model1; BSTR SerialNumber; BSTR IpAddress1; char* IpAddress; BSTR Port1; int Port; BSTR LocationCode; SOCKET Sock; BSTR...
30 Oct 2012 by Richard MacCutchan
// your definition of your structuretypedef struct MachineList{ // details ...} MACHINELIST;// your vector declarationvector SS;But MACHINELIST does not take the struct keyword, as that is already implied from the typedef. I would also question why you are using BSTR types...
31 Oct 2012 by user_code
Hello,I have an image, including image header, stored in a c# byte array (byte []).The header is at the beginning of the byte array.If I put the header in a struct (as I did in c++) it looks like this:typedef struct RS_IMAGE_HEADER{ long HeaderVersion; long Width; ...
10 Apr 2013 by unscathed18
Consider the next code:#include #include struct SCredentials{ char name[30]; char country[20];};typedef struct SCredentials Credentials;struct SGymnast{ char sport[20]; int nMedals[3]; Credentials * cred;};typedef struct...
11 Apr 2013 by unscathed18
Thanks all for your answers. Not assigning any value to the pointer was in fact a mistake of mine with the rush I had to post this on the forum.
11 Oct 2013 by ASP.NET Community
What is Access Modifier?Objects in .NET are created from a class, struct, etc.  Thesedefinitions, as well as the properties, methods, or events
14 Jan 2014 by Robert Clove
Hey All I am facing a problem for creating the struct pointer different for every user#includestruct mine_struct{ int a;};int main(){ for(int i=0;i
14 Jan 2014 by OriginalGriff
You can't do that: you are specifically setting the value of the pointer to null and then trying to access data via it - that won't work under any circumstances.I would suggest that you need to look at malloc[^] and free[^] but I can't help you much further as your description of what you want...
27 Mar 2014 by Jeevan83
I wanna define a structure in a header file so that I can use it in multiple .cpp files. And also I wanna use the same structure variable in different .cpp files. I tried and got this error. Please help me. This is my entire header file, the definition of structure is at the bottom. Thanks! And...
27 Mar 2014 by User 59241
Seems obvious by reading the error.http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=%2Fcom.ibm.vacpp7a.doc%2Flanguage%2Fref%2Fclrc03extsc.htm[^]"•In C++, an extern declaration cannot appear in class scope."
19 Apr 2014 by Member 10760657
I have to get data from a COM-module, using the following function:HRESULT ADObj.GetArchiveFinInfoFromDB(BSTR PlaceCode, BSTR PCode, long Period, VARIANT DateFrom, VARIANT DateTo, BSTR * Result)Please, give an example of how to put a particular date into it.Here is VARIANT...
19 Apr 2014 by CPallini
Here an example: "Setting the Type Tag Field" at MSDN[^].Have also a look at "COleDateTime Class"[^].
29 Jul 2014 by Member 10978878
I have the following code that is giving me a Huge problem, and cant seem to figure out why.I stored some information to a file and i want to read it out back but it keeps on reading out 9 variables instead of the 14 and i dont know why.Reading out code ( i have left out some of the code...
6 Aug 2014 by OriginalGriff
All you need to do (and since this is your homework you will get no code) is use one of the sorting algorithms you mention - and explanations / code for all of those is easily available to anyone with access to Google - and provide a function to compare two structs according to your criteria...
3 Dec 2014 by theafien
I Have this struct:public struct A{ public int first;}public struct B{ [MarshalAs(UnmanagedType.ByValArray, SizeConst=32)] public char[] first;}[StructLayout(LayoutKind.Explicit)]public struct CUnion{ [FieldOffset(0)] public A _a; ...
3 Dec 2014 by Er. Dinesh Sharma
Please Try thispublic struct A { public int first; } [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct B { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public char[] first; } [StructLayout(LayoutKind.Explicit)] ...
18 Mar 2015 by manchanx
edit: I just realized I only explained why it doesn't work like you expect in C#, I can't tell why it's different in C++ /edit You replace the references to the individual xy_arrays in xevents_array 1-4 with the reference to the xy_array of xevents_array 0 here:for (i = 1; i
11 May 2015 by sreedharmaruthi
Hi, I have structure :struct StartReadXML { public int CmdID;//3 public char[] CmdName;//ReadXML public char[] Description; };With initializations as below :StartReadXML startXML=new StartReadXML(); startXML.CmdID = 3; ...
25 May 2015 by Sergey Alexandrovich Kryukov
You bug is in append:int append(list* lst, int val){ node* cur = lst->head; node* prev; if (cur == NULL) { node temp; temp.val = val; temp.next = NULL; lst->head = &temp; return 0; } while (cur->next != NULL) { // bug is here! -- SA cur = cur->next; prev =...
19 Jun 2015 by Member 11779222
If I have the following C code:struct A{struct B* element;}struct B{struct A* element;}main(){}How do I compile it if when I declare the variable element of type "struct B*" this type wasn't defined yet?And how would I make the makefile and the header files if I had those 2...
1 Jul 2015 by mhh1986
since the length of string only 10 , it is not worth to use hash, try to compare string to string.instead of using if (cars[i].car_plate == car_platetofind) use strcmp to compare the 2 string. last note (related to security) when you assign the car_plate be sure that you assign only...
1 Jul 2015 by CPallini
That wouldn't work for several reasons. As already noted you cannot compare strings that way, you have to use strcmp[^] (or strncmp) instead.You never allocate memory for items of the cars array (you didn't even declare it as an array).As already noted you didn't check the user input (it...
5 Jul 2015 by Daniel Pfeffer
I will answer the specific question that you asked (leaving all other errors for you to find).When calling procurarNumeroserie() for the first time, contadorProdutos == 0. This means that the loop is not executed, leaving posicao as zero. The caller sees this as an indication that the...
2 Sep 2015 by Sergey Alexandrovich Kryukov
I see absolutely no reason to do anything unsafe.struct MyStruct { internal abs; bca;}//...MyStruct myStruct = new MyStruct();myStruct.abc = 1;//...—SA
13 Sep 2015 by Member 10191561
I need to fetch the number of days a particular employee is present from a table. Since i should also take the current date and find the starting day of the month and for that days it should display the present count.
13 Sep 2015 by Animesh Datta
Hello ,here is a sample . --First create one temporary table .CREATE TABLE #TMP ( NAME VARCHAR(50), DATE DATETIME , PRESENT_STATUS VARCHAR(10) ) --insert data INSERT INTO #TMP VALUES ('A','2016-07-01','PRESENT') INSERT INTO #TMP VALUES...
29 Sep 2015 by Max Melnikov
I create a data collection system that has a tree-like structure built on the similarity to the pattern of the factory, and I have the difficulty in working with this structure, more stingrays lot of code to find the element opredelnie. public interface ITag : IRegister{ string...
1 Nov 2015 by DotNetSteve
It looks as as though the top and bottom have identical code except for the node type (one being TCP, the other RTU) could you use an interface or base class to code against and eliminate half your code?Example:INode = interfaceTCPNode : INodeRTUNode : INodeINode _node = Either...
13 Feb 2016 by Member 12325023
I am trying to unpack the following struct from binary data received via UDP from a time attendance clock device(DeviceName=TA8020): typedef struct _AttLog_{ Int PIN; //U16 PIN, user number char verified;// verifying method time_t time_second; //time, time code is user-defined time...
13 Feb 2016 by Member 12325023
Thanks - I was able to figure it out:state = unpack('c',attendancedata[29:30])
18 Mar 2016 by Nafees Hassan
I have a union, which stores either a string or a double. AS you know, unions store only one type, how do I identify which type was last assigned to it, or in other words, which type is it currently storing? Plus, I'm using the D language, there isn't a tag for it, so I had to write it...
8 Apr 2016 by lukeer
Hello fellow CPians, as part of an attempt to pass messages back and forth between two µCs, I created Message_t. To send such a message, user has to tell the sending function, how many bytes to transfer.I'd like to have a notation for Message_t that has a message type declared in one...
17 Aug 2016 by mariaclara
I've been working on this code, everything's been fine until the compiler gave me an error C:\Users\dcst\Desktop\file\main.cpp|108|error: no match for 'operator
17 Aug 2016 by Jochen Arndt
You are trying to write to an input stream using the
10 Jan 2017 by JohnnyG62
I need to have a vector of a struct. That's easy but when I try to define a iterator for it I get this error on line 23 (the last line where I try to declare the interator)template class std::vector’ used without template parameters. Here is all the code#include...
10 Jan 2017 by Richard MacCutchan
Your declaration of the iterator is wrong, it should be: vector::iterator FieldsResultsit;// not // vector::::std::iterator FieldsResultsit;
26 Jan 2017 by Llooyyddiiee Kun
#include#include#include#includeusing namespace std;void printBook(struct Books book);void printBorrower(struct borrower borrow);struct Books{ char title[50]; char author[50]; char subject[50]; int book_id;};struct...
26 Jan 2017 by Albert Holguin
Using cin>> followed by cin.getline() can lead you to believe getline() is missing things:Tips and Tricks for Using C++ I/O (input/output)[^]
15 Feb 2017 by Member 13002551
Will casting around sockaddr_storage and sockaddr_in break strict aliasing? For example in the code below, I'm filling sockaddr_storage structure with a pointer of type `sockaddr_in` and then passing it to a function that accepts a pointer of type `sockaddr` -sockaddr_storage...
15 Feb 2017 by Jochen Arndt
There has been already much said in the mentioned SO thread. But I would not care too much. Here is my (a bit pragmatic) view:These socket structures are a little bit special because the sockaddr parameter of the socket functions is usually never passed as such but by casting an appropriate...
21 Feb 2017 by Member 12606650
Hi,May be too much to ask, but I'll give it a go. I've worked in C for almost 30years, C++ for almost 15, but am new to C#.We have a large application in C. It stands up a tcp/ip server foradministration. Currently, there is an x-windows GUI client (in C) thatconnects into this...
21 Feb 2017 by Garth J Lancaster
While I agree with Dave K, you could use c# binary serialisation, you could also use Google protobuf, JSON or perhaps Binary JSON as the 'encoding' - to me, that's the easy part ... The 'Hard Part' is, you have a 'Spec' on one side, defining some 100 different structs - what happens when...
21 Feb 2017 by Jon McKee
How you read from TCP/IP is up to you. It sounds like you already had a client/server that worked. Option #1:Turn the core TCP/IP client code into a DLL and PInvoke it in C#:[DllImport("tcpipclient.dll", CallingConvention.Cdecl)]public static extern TestHeader GetHeader();To do...
15 Apr 2017 by Konahrik16
I'm working on a database in C that prompts the user to enter a unique identifier code (UID) for a product e.g. an int value of 1, for the first item, 2 for the next, 3...etc..etc... However, when I try compare each UID the if statement doesn't catch the "error" that another item has the same...
15 Apr 2017 by Patrice T
Your code is plain wrong, but since it look like HomeWork, no full blowup solution. Here is how you would organize your code loop until user have entered a UID prompt user for new ID get user input loop for every item in inventory compare item ID with new ID if it...
1 Aug 2017 by MinYoung Lee
I want to enumerate all of the process id running on my system by using EPROCESS structure but the problem here is, I do not know how to access to the UniqueProcessId field in EPROCESS structure. Now, I've got the pointer to EPROCESS structure by this function PEPROCESS Process;...
1 Aug 2017 by Jochen Arndt
How is PEPROCESS defined? If you have the full structure just access the member: PVOID UniqueProcessId = Process->UniqueProcessId; If you know the offset and the type, cast Process to a byte or char pointer, add the offset, cast the result as pointer to the field type, and get the value:...
16 Nov 2017 by Member 13476370
** Define a structure to represent a student data including the GPA, student ID, and student name. ** Write a function that reads the data of N students. My problem is: the program doesn't print the name instead it prints(garbage)and(-1.#QUANO) also it reads the first element of array...
16 Nov 2017 by Patrice T
Quote: I can't find what went wrong cause it compiled well! 'the cat flies high in the sky' is correct English word and correct English grammar, but is meaningless. It is the same with programs, correct syntax is not enough. Quote: the data entered by the user is not properly stored in array[] ...
16 Nov 2017 by Jochen Arndt
Never mix scanf and gets calls for input. gets - C++ Reference[^] will read until (and inclusive) a new line character but does not store the new line in the buffer. scanf - C++ Reference[^] for non-character formats ignores leading white spaces but stops after reading the requested type...
29 Nov 2017 by Member 13476370
this function inserts a book info into structure .. it works well but when scanning the date the program crushes..I searched a lot but couldn't fix it typedef struct { char title[10]; char author[10]; char publisher[10]; char ISBN[10]; dateStruct* date; int copies; ...