Hi, this code seems to work, but I don't know if it really is working because I get a different size of what I spect. The code is:
The problem that I have is that didn't understand is the second printf because I expect to be bigger because the call to malloc.Code:#include <stdlib.h> int *buff main(int argc, char argv[]) { if ((buff = malloc(sizeof(int)*4)) = NULL) { printf("Malloc didn't work"\n); } else { printf("Malloc worked\n"); *buff = 1; printf("%d\n", *buff); printf("%d\n", sizeof(buff));
I suppose malloc is working, but don't know what is doing?.



LinkBack URL
About LinkBacks


