G-Fact 14
In C, a structure cannot have static members, but in C++ a structure can have static members.
For example, following program causes compilation error in C, but works in C++.
#include<stdio.h> struct test { static int i; // Error in C, but works in C++. }; int main() { struct test t; getchar(); return 0; } |
chevron_right
filter_none
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Recommended Posts:
- GFact 22 | (2^x + 1 and Prime)
- GFact 23 | (Brocard’s problem)
- Can C++ reference member be declared without being initialized with declaration?
- Storage of integer and character values in C
- Vantieghems Theorem for Primality Test
- Cauchy's Mean Value Theorem
- Nesbitt's Inequality
- G-Fact 20 (Cayley's formula for Number of Labelled Trees)
- G-Fact 19 (Logical and Bitwise Not Operators on Boolean)
- fseek() vs rewind() in C
- G-Fact 9
- What is evaluation order of function parameters in C?
- How are variables scoped in C - Static or Dynamic?
- G-Fact 7
- What are the operators that can be and cannot be overloaded in C++?



