- When your program needs memory…you can allocate it on the fly.…That includes memory for any variable type array…or even a structure.…In this movie, I demonstrate how structures…can be created using pointers…with their memory allocated as the program runs.…In this code, storage for a structure is allocated.…The structure has to be defined first,…which happens at line six.…Remember, that a structure itself, isn't a variable.…It's simply a declaration of what…the contents of a structure would be.…
In this case, the members are month, day, year.…At line 11, a pointer variable…for that kind of structure is created.…The pointer is a memory location.…It's not the structure.…Storage for the structure is allocated at line 13,…courtesy of the malloc function.…See how the "sizeof" operator is used…to allocate enough storage for the structure itself.…
And the structure's name is used,…not the structure pointer variable.…Assuming that the structure is created,…lines 20 through 25 fill the structure.…Because the structure is referenced by a pointer,…
Author
Released
10/10/2014- Understanding a C program
- Adding comments
- Using escape characters
- Working with values and placeholders
- Introducing variables
- Making a decision with if
- Looping
- Adding functions
- Manipulating strings
- Building arrays
- Nesting structures
Skill Level Beginner
Duration
Views
Related Courses
-
Introduction
-
Welcome46s
-
Using the exercise files1m 20s
-
-
1. Getting Started
-
Programming overview3m 56s
-
Configuring Code::Blocks3m 47s
-
Compiling a sample program4m 59s
-
-
2. Programming Basics
-
Understanding a C program7m 43s
-
Sending text to output2m 13s
-
Adding comments to the code2m 26s
-
Introducing variables7m 3s
-
Using character I/O6m 24s
-
Working with math7m 19s
-
Making more calculations5m 34s
-
-
3. Program Flow Control
-
Looping with while8m 2s
-
Nested loops4m 8s
-
Adding a function6m 8s
-
Passing values to a function2m 54s
-
4. Intermediate C Language Concepts
-
Manipulating strings6m 28s
-
Building arrays6m 45s
-
Understanding structures5m 3s
-
Working with time functions5m 53s
-
5. Advanced C Language Concepts
-
Understanding variables5m 57s
-
Creating pointer functions5m 36s
-
Working with pointer arrays4m 21s
-
Allocating memory3m 13s
-
Building a linked list8m 5s
-
-
Conclusion
-
Next steps2m 11s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Structures with structures