100 likes | 115 Views
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’;
E N D
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’; 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’; 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)
#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
#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)
#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
#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)
#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)
#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; }