找考题网-背景图
未分类题

下列程序的输出结果是( )。 main() {char a[7]='a0/0a0/0';int i,j; i=sizeof(a); j=strlen(a); printf('%d %d/n',i,j); }
A.2 2
B.7 6
C.7 2
D.6 2

A.2
B.7
C.7
D.6

【参考答案】

C
解析:函数sizeof(a)的功能是求出字符串a中的字符占用存储空间的大小,由于字符数组a有长度为7,所以i=7;函数strlen(a)的功能是:求出字符串a的长度。而每个字符串都以'\0'为字符串的结束标记,所以j的值等于2。
热门试题

未分类题In the United States, the first day-nursery was opened in 1854.@Nurseries were established in various areas during the (1)_____ half of the 19th century; most of them were (2)_____ Both in Europe and in the U. S., the day-nursery (3)_____ received great (4)_____ during the First World War, when (5)_____ of manpower caused the industrial employment (6)_____ numbers of women. In some European countries nurseries were established (7)_____ in munitions (军火)plants, under direct government (8)_____ Although the number of nurseries in the U. S. also rose (9)_____, this rise was accomplished without government aid of any kinD.During the years following the First World War, (10)_____, Federal, State, and local governments gradually began to exercise a measure of control over the day-nurseries, chiefly by (11)_____ them and by inspecting and regulating the conditions within the nurseries.The (12)_____ of the Second World War was quickly followed by an increase in the number of day-nurseries in almost all countries, as women were again called upon to replace men in the factories. On this (13)_____ the U.S. government immediately came to the support of the nursery school, (14)_____ $6,000,000 in July, 1942, for a nursery school program for the children of working mothers. Many States and local communities (15)_____ this Federal aiD.By the end of the war, in August, 1945, more than 100,000 children were being cared for in day-care centers receiving Federal (16)_____. Soon afterward, the Federal government (17)_____ cut down its (18)_____ for this purpose and later (19)_____ them, causing a sharp drop in the number of nursery schools in operation. However, the (20)_____ that most employed mothers would leave their jobs at the end of the war was only partly fulfilleD.A.latterB.lateC.otherD.first

A.@Nurseries
B.,
C.
D.S.
E.
A.latter
B.late
C.other