1 / 10

Building a Stack

Building a Stack. Assumes NO Padding. #include < stdio.h > int main(){ int NUMBER = 40; char LETTER = ‘Z’; int EXAMS[3] = {85, 92, 100}; char TEXT[7] = “CYBER”; int *PTR1 = &NUMBER; char *PTR2 = TEXT; }. #include < stdio.h > int main(){ int NUMBER = 40; char LETTER = ‘Z’;

dnatale
Download Presentation

Building a Stack

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Building a Stack Assumes NO Padding

  2. #include <stdio.h> int main(){ int NUMBER = 40; char LETTER = ‘Z’; int EXAMS[3] = {85, 92, 100}; char TEXT[7] = “CYBER”; int *PTR1 = &NUMBER; char *PTR2 = TEXT; }

  3. #include <stdio.h> int main(){ int NUMBER = 40; char LETTER = ‘Z’; int EXAMS[3] = {85, 92, 100}; char TEXT[7] = “CYBER”; int *PTR1 = &NUMBER; char *PTR2 = TEXT; }

  4. #include <stdio.h> int main(){ int NUMBER = 40; char LETTER = ‘Z’; int EXAMS[3] = {85, 92, 100}; char TEXT[7] = “CYBER”; int *PTR1 = &NUMBER; char *PTR2 = TEXT; } Convert 40 to Hex (0x28) Integers are 4 bytes (0x00 00 00 28) Little Endian Order : MSB at highest address (bottom)

  5. #include <stdio.h> int main(){ int NUMBER = 40; char LETTER = ‘Z’; int EXAMS[3] = {85, 92, 100}; char TEXT[7] = “CYBER”; int *PTR1 = &NUMBER; char *PTR2 = TEXT; } Convert character ‘Z’ to Hex using ASCII Table

  6. #include <stdio.h> int main(){ int NUMBER = 40; char LETTER = ‘Z’; int EXAMS[3] = {85, 92, 100}; char TEXT[7] = “CYBER”; int *PTR1 = &NUMBER; char *PTR2 = TEXT; } First element of an array at the lowest address (top) Convert 85, 92, 100 to Hex (0x55, 0x6C, 0x64) Integers are 4 bytes (e.g. 0x00 00 00 55) Little Endian Order : MSB at highest address (bottom)

  7. #include <stdio.h> int main(){ int NUMBER = 40; char LETTER = ‘Z’; int EXAMS[3] = {85, 92, 100}; char TEXT[7] = “CYBER”; int *PTR1 = &NUMBER; char *PTR2 = TEXT; } First element of an array at the lowest address (top) Convert character ‘CYBER’ to Hex using ASCII Table Automatic Null Terminate at the end of strings

  8. #include <stdio.h> int main(){ int NUMBER = 40; char LETTER = ‘Z’; int EXAMS[3] = {85, 92, 100}; char TEXT[7] = “CYBER”; int *PTR1 = &NUMBER; char *PTR2 = TEXT; } & required to get the address of a variable Little Endian Order : MSB at highest address (bottom)

  9. #include <stdio.h> int main(){ int NUMBER = 40; char LETTER = ‘Z’; int EXAMS[3] = {85, 92, 100}; char TEXT[7] = “CYBER”; int *PTR1 = &NUMBER; char *PTR2 = TEXT; } & not required to get the address of an array Note : & required for array elements (e.g. &TEXT[5] or &EXAMS[2] Little Endian Order : MSB at highest address (bottom)

  10. #include <stdio.h> int main(){ int NUMBER = 40; char LETTER = ‘Z’; int EXAMS[3] = {85, 92, 100}; char TEXT[7] = “CYBER”; int *PTR1 = &NUMBER; char *PTR2 = TEXT; }

More Related