Amazon Auto Links: No products found.
You’re a liar, this video isn’t sixty seconds long!
in my mind memory is a huge stack of addresses in which to store data, not like a grid 🙂
Very good video, thanks
not much understandable …..
pakistanis and Indians are much better to explain this ……
the visualization drawing is a really good way to teach, but how can u be so sure that the variables you create will pile up in the order that you initial them to be?
let’s say you declare a string array, without initializing it ( it takes values from the user).
since the size of this array will depend on the user input, how will the program know how much space to keep for it?
what happens in that case?
Hey adam I’m not able to print the string when i pass the address of Bob as &s1+2…can u plz tell why not?
so the short will be cast to 4 byte before pushed in the stack
“bottom of stack” :’D 😛
“memory is more like a grid”
Well, no, more like address locations stacked on top of each other, as you were drawing it.
It’s actually an image that I found on google.
When/If you get into an assembly language, this sort of thing is very useful. Also, I think it’s important to have a gist of what’s going on behind the code you write.
Often compilers will rearrange variables for speed and ease of access.
h tt p :// stackoverflow . com/questions/238441/can-a-c-compiler-rearrange-stack-variables
we can only push a 4 byte in the stack !!
thnx a lot.. but can u make more videos on dynamic data structures in C?
I’m not really sure what you’re asking. There is no way to make an array without giving it a size. You could create a pointer, like this:
Then you could start assigning values to it like this:
myArray = 6;
But that doesn’t really make any sense. The address stored in that pointer will be just some random value that happened to be on the stack. That assignment will most likely result in a segmentation fault because it will be accessing a random part of memory.
I was expecting you to explain the stack as a data structure, and implement it in C, not some fucking memory management stuff what a waste of time
是不是在C语言中， 对于用户输入的未指定长度的字符串，只能定义一个足够 大的字符数组来解决？有没有方便点的方法?
Thank you for your tutorials.
I have a question, I would like to print address and value of an int:
int i = 6;
str = “test”;
printf(“%i = %in”, &str1 + 1, &str1 + 1);
whats the fundamentals of this? what is stack knowledge use for?