Member Avatar
Consider the following code: #include<stdio.h> #define msizeof(type) ((char*)(&type) - (char*)(&type - 1)) int main() { int x; printf("%u %u\n", msizeof(x), sizeof(x)); return 0; } The Above code when compiled with g++ compiles just fine and works well without any wanrings, while in gcc it gives the following warning: `integer overflow …
by tapananand 13 in Software Development ()
Member Avatar
Is the sizeof operator in c a compile time or run time operator..Because the following code works fine with a gcc compiler int a; scanf("%d",&a); printf("%d",sizeof(a)); But I found in one of the tutorials thatsizeof is compile time??Can someone please clear the confusion?
by saurabh.mehta.33234 13 in Software Development ()
Member Avatar
if would like to print the size of data type entered by user. how can i do so (without using case and if) is it possible to store the data type in a string and print the size of data type in that string???
by jatinkhandelwal in Software Development ()
Member Avatar
Hello everybody, I have never done anything with dynamic memory allocation and was trying to allocate enough memory to hold four elements of an array. Each of these elements will hold another array that will hold the actual data. My questions is how can I check the size of a …
by DmytriE in Software Development ()
Member Avatar
All things equal, does an object of a class which has methods take up more memory resources than an instance of a class without methods. What if it is a vector of such objects? For example: [CODE] class A{ public: void DoSomething(); void DoSomethingelse(); private: int x, y; }; class …
by Jsplinter in Software Development ()