#include #include void main() { struct site { char name[] = “laptrinhc++”; int year = 2; }; struct site *ptr; printf(“%s “, ptr->name); printf(“%d”, ptr->year); getch(); } What is output?

#include

#include

void main()

{

struct site

{

char name[] = “laptrinhc++”;

int year = 2;

};

struct site *ptr;

printf(“%s “, ptr->name);

printf(“%d”, ptr->year);

getch();

}

What is output?

A. laptrinhc++ 2

B. Complier error

C. Runtime error

Hướng dẫn

Chọn B là đáp án đúng

Xem lời giải

Xem lời giải

Chỉ có member static của struct mới được phép khởi tạo bên trong struct

 

Đánh giá chủ đề này
How to whitelist website on AdBlocker?

How to whitelist website on AdBlocker?

  1. 1 Click on the AdBlock Plus icon on the top right corner of your browser
  2. 2 Click on "Enabled on this site" from the AdBlock Plus option
  3. 3 Refresh the page and start browsing the site