Static Data Members (Shared State)

Easy Static Members & Friend Functions
Solve in Playground →

Problem Statement

Define a `Company` class with a `public` static integer attribute named `employee_count`. Initialize this static member to 0 outside the class definition. In `main()`, print ‘Initial Count: [count]’.

Input Format

None

Output Format

Print the initialized static variable.

Constraints

None

Sample Output

Initial Count: 0

Explanation

Static data members belong to the class itself rather than any specific object, and must be explicitly defined outside the class.

Starter Code

#include <iostream>

class Company {
public:
    // Declare static integer employee_count here
};

// Initialize employee_count to 0 here

int main() {
    // Print the initial count
    return 0;
}

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used