Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8105593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:12:25+00:00 2026-06-06T00:12:25+00:00

Today, i was a little bit surprised about the behavior of c structure vs

  • 0

Today, i was a little bit surprised about the behavior of c structure vs c++ structure.

fun.cpp: http://ideone.com/5VLPC

struct nod
{
    static int i;
};

int main()
{

    return 0;  
}

The above program works perfectly.

BUT,

When the same program is run in C environment, it is giving the error:

prog.c:3: error: expected specifier-qualifier-list before ‘static’

see here: http://ideone.com/2JRlF

Why it is so?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:12:27+00:00Added an answer on June 6, 2026 at 12:12 am

    Because in C++, structs are just classes with default visibility of public. So in C, the struct is only a aggregation of data, which does not know anything about the fact that it could be percieved as standalone type.

    See also What are the differences between struct and class in C++

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today I want to learn a little bit about the R statistical programming language.
today I just tried to play a little bit around with the opcodes in
I've got a wonderfully fun little SQL problem to solve today and thought I'd
I am looking for a little bit of guidance today with the issue I
Today I worked a little bit with OSGi Hooks, specially with FindHook and EventListenerHook
I did something a little bit nasty today. All of our view controllers inherit
I am feeling a bit thick today and maybe a little tired.. I am
I just today learned a little about Composition over Inheritance . I was wondering
I'm kind of confuse a little bit, I just got my Macbook Pro today
Today i have a little problem containing a File Upload. First some Infos: Rubyversion:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.