Anonymous
struct fish joe; puts("enter name:"); scanf("%s", joe.name); puts("enter species:"); scanf("%s",joe.species); puts("enter teeth:"); scanf("%i", joe.teeth); puts("enter age:"); scanf("%i", joe.age); catalog(joe); label(joe);
Anonymous
i trying something like this
Anonymous
@das_3sz3tt
Anonymous
Anonymous
it compiles but error after i press enter when i place the first input
Anonymous
Really, so many messages about structs?
Anonymous
Really, so many messages about structs?
chapter 5 is all about structs
Ilya
@MasterZiv you know
I have no idea what is yocto
Artöm
Because you didnt allocate memory for string fields
Anonymous
Because you didnt allocate memory for string fields
yes i am creating a seperate examples as we speak to test this out
Anonymous
Which book do you use? Use Prata
head first C, its good for beginners but they leave out some stuff , like how to deal with \n character in fgets
Anonymous
between that book , stackoverflow, google, youtube and the chat, i gather the information i need
Anonymous
Artöm
Who's the author?
https://www.oreilly.com/library/view/head-first-c/9781449335649/
Anonymous
head first has a whole series of different languages but its meant specifically for beginners, like coding for dummies
Anonymous
yea that one
Ilya
David Griffith
It's a pice of shit, useful only in the toilet
Anonymous
i never found a book where i didnt have to research externally to get a full understanding
Anonymous
but i am going to read ANSi C programming next , second edition
Ilya
yea that one
Read Prata, "C Premier", I suppose, it's name. Or, combine your stupid book with Harbison, Steel "Annotated C"
Shanks
Why STL is introduced in c++?
MᏫᎻᎯᎷᎷᎬᎠ
What?!
Ilya
Why STL is introduced in c++?
What is your question? Where could it be introduced else if not in C++?
Artöm
Ilya
It was good enough
It was not because c++ was appended and adopted to some new features only to implement STL
Stanislav
Why STL is introduced in c++?
https://en.wikipedia.org/wiki/Standard_Template_Library
Anonymous
when using scanf for ints stored in a struct, do you do something like stuct_Variable.&age
olli
when using scanf for ints stored in a struct, do you do something like stuct_Variable.&age
To get the address of a member use &structVar.Member or &ptrToStruct->Member
Anonymous
https://pastebin.com/n5AA2iVa : main file ,
Anonymous
https://pastebin.com/BMTaq3Kj : header file
Anonymous
https://pastebin.com/2KTjx55s : functions.c file
Anonymous
https://pastebin.com/8LbJqeFX : makefile
Anonymous
it compiles and runs, but doesnt work as intended
Anonymous
its doesnt seem like the scanf statement in the add_Student function is storing the information in the struct variables declared in the main.c
Anonymous
Can you show your structure definition?
struct student{ char name[80]; int age; int grade; };
Ilya
struct student{ char name[80]; int age; int grade; };
For such functions void print_Student_Info(struct student stu){ it is better to pass structure by reference, that is, via pointer. void print_Student_Info(struct student *stu) also, better pass it as const void print_Student_Info(const struct student *stu){
Anonymous
For such functions void print_Student_Info(struct student stu){ it is better to pass structure by reference, that is, via pointer. void print_Student_Info(struct student *stu) also, better pass it as const void print_Student_Info(const struct student *stu){
void print_Student_Info(const struct student *stu){ printf("%s is a Student here\nThis student is %i years old\n This student is in the %i grade\n" ,stu->name,stu->age, stu->grade); }
Anonymous
something like this?
Dima
please format your code
Dima
like this
Anonymous
like this
whats the commands on telegram for that
Dima
whats the commands on telegram for that
put tripple ` around your code
Dima
'```’ text ‘```'
Dima
without ‘
Anonymous
without ‘
better now
Anonymous
i stand corrected head first c does example
Anonymous
i just skipped ahead and tried some things before it was explained
Anonymous
they literally explained what i was looking for within in the next 5 pages
Stanislav
whats the commands on telegram for that
for telegram desktop you can select text and press Ctrl-M
14•08
What?
Dima
Anonymous
Hi
Ludovic 'Archivist'
https://en.wikipedia.org/wiki/Standard_Template_Library
I cringe real hard when people talk about the STL to mean C++ standard library. To me the STL still means the Silicon Graphic STL
Ludovic 'Archivist'
Which is dead since 2 decades ago
Ludovic 'Archivist'
I have bad news for you then... Today is 2019, almost 2020
And the STL is dead since 1998 to be folded in the standard library of C++98
Ludovic 'Archivist'
I think a bunch of crazy people still keep an archive of the old source tho
Ludovic 'Archivist'
Lol Sillicon Graphics
You understand my cringe now
Ilya
I think a bunch of crazy people still keep an archive of the old source tho
Yes, but it has been a piece of shit always and only now with move semantics, with new ranges it is becoming something valuable.
Ludovic 'Archivist'
The only consistently maintained actual version of the actual STL may be EASTL
Ludovic 'Archivist'
And given the maintainer, it may one day be distributed with paid DLCs xD
Ludovic 'Archivist'
And it is not similar to the standard library by any stretch of the imagination
Dima
Sillicon Graphics Library 2020