5 Topics

Member Avatar for
Member Avatar for tapananand

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 …

Member Avatar for vijayan121
0
829
Member Avatar for saurabh.mehta.33234

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?

Member Avatar for deceptikon
0
390
Member Avatar for jatinkhandelwal

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???

Member Avatar for Ancient Dragon
0
121
Member Avatar for DmytriE

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 …

Member Avatar for DmytriE
0
114
Member Avatar for Jsplinter

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 …

Member Avatar for mike_2000_17
0
135

The End.