没有合适的资源?快使用搜索试试~ 我知道了~
题三:Pointers and Arrays Structures, Unions and Bit-Fields1
需积分: 0 0 下载量 184 浏览量
2022-08-08
20:43:45
上传
评论
收藏 275KB DOCX 举报
温馨提示
试读
78页
英文题库C目录1. Data Types, Operators and Expressions 1 Variable Names – 1 1 Data Type
资源详情
资源评论
资源推荐
i
英文题库 C
目录
1. Data Types, Operators and Expressions .................................................................................1
Variable Names – 1 ...................................................................................................................1
Data Types and Sizes – 1...........................................................................................................3
Constants – 1 ............................................................................................................................6
Declarations – 1 ......................................................................................................................10
Arithmetic Operators – 1 ........................................................................................................14
Relational & Logical Operators – 1 .........................................................................................17
Type Conversions – 1 ..............................................................................................................20
Increment and Decrement Operators – 1...............................................................................23
Bitwise Operators – 1 .............................................................................................................26
Assigment Operators & Expressions – 1 .................................................................................29
Conditional Expressions – 1 ....................................................................................................32
Precedence and Order of Evaluation – 1 ................................................................................35
Precedence and Order of Evaluation – 2 ................................................................................40
Precedence and Order of Evaluation – 3 ................................................................................44
2. Control Flow Statements .....................................................................................................48
If-then-else Statements – 1 ....................................................................................................48
Switch Statements – 1 ............................................................................................................53
For Loops – 1...........................................................................................................................58
While Loops – 1.......................................................................................................................61
Break and Continue – 1...........................................................................................................65
Goto & Labels – 1....................................................................................................................68
3. Functions and Structure of a Program..................................................................................72
Basics of Functions – 1............................................................................................................72
Functions Returning Non-integers – 1 ....................................................................................76
External Variables – 1 .............................................................................................................79
Scope of a Variable – 1 ...........................................................................................................83
Static Variables – 1..................................................................................................................86
Register Variables – 1 .............................................................................................................89
Automatic Variables – 1..........................................................................................................92
C-Preprocessor – 1..................................................................................................................94
File Inclusion – 1 .....................................................................................................................96
Macro Substitution – 1 ...........................................................................................................99
Conditional Inclusion – 1.......................................................................................................103
4. Pointers and Arrays ...........................................................................................................106
Pointers and Addresses – 1...................................................................................................106
Pointers and Function Arguments – 1 ..................................................................................109
Pointers and Arrays – 1.........................................................................................................114
Address Arithmetic – 1 .........................................................................................................117
Character Pointers and Functions – 1...................................................................................120
ii
Pointers to Pointers – 1 ........................................................................................................124
Multidimensional Arrays – 1.................................................................................................127
Initialization of Pointer Arrays – 1 ........................................................................................130
Pointers Vs. Multi-dimensional Arrays – 1............................................................................133
Command Line Arguments – 1..............................................................................................136
Pointers to Functions – 1 ......................................................................................................138
Complicated Declarations – 1 ...............................................................................................142
5. Structures, Unions and Bit-Fields .......................................................................................148
Basics of Structures – 1.........................................................................................................148
Structures and Functions – 1 ................................................................................................152
Arrays of Structures – 1 ........................................................................................................155
Pointer to Structures – 1.......................................................................................................159
Self-Referential Structures – 1..............................................................................................164
Table Lookup – 1...................................................................................................................168
Typedefs – 1..........................................................................................................................172
Unions – 1 .............................................................................................................................176
Bit-fields – 1 ..........................................................................................................................179
6. Input and Output ...............................................................................................................182
Standard Input & Output – 1 ................................................................................................182
Formatted Output – 1...........................................................................................................184
Variable Length Argument – 1 ..............................................................................................187
Formatted Input – 1..............................................................................................................189
File Access – 1 .......................................................................................................................192
Error Handling – 1.................................................................................................................194
Line Input & Output – 1 ........................................................................................................197
String Operations – 1 ............................................................................................................200
Character Class Testing & Conversions – 1 ...........................................................................203
Ungetc – 1.............................................................................................................................206
Storage Management – 1 .....................................................................................................209
Mathematical Functions – 1 .................................................................................................211
Random Number Generation – 1..........................................................................................214
7. Floating Point & Sizeof Operator........................................................................................216
Float Datatype – 1.................................................................................................................216
Sizeof – 1...............................................................................................................................218
1
4. Pointers and Arrays
Pointers and Addresses – 1
1. What is the output of this C code?
1. #include <stdio.h>
2. void main()
3. {
4. int k = 5;
5. int *p = &k;
6. int **m = &p;
7. printf("%d%d%d\n", k, *p, **m);
8. }
a) 5 5 5
b) 5 5 junk value
c) 5 junk junk
d) Run time error
View Answer
Answer:a
2. What is the output of this C code?
1. #include <stdio.h>
2. void main()
3. {
4. int k = 5;
5. int *p = &k;
6. int **m = &p;
7. printf("%d%d%d\n", k, *p, **p);
8. }
a) 5 5 5
b) 5 5 junk value
c) 5 junk junk
d) Compile time error
View Answer
Answer:d
3. What is the output of this C code?
1. #include <stdio.h>
2. void main()
3. {
4. int k = 5;
5. int *p = &k;
2
6. int **m = &p;
7. **m = 6;
8. printf("%d\n", k);
9. }
a) 5
b) Compile time error
c) 6
d) Junk
View Answer
Answer:c
4. What is the output of this C code?
1. #include <stdio.h>
2. void main()
3. {
4. int a[3] = {1, 2, 3};
5. int *p = a;
6. int *r = &p;
7. printf("%d", (**r));
8. }
a) 1
b) Compile time error
c) Address of a
d) Junk value
View Answer
Answer:b
5. What is the output of this C code?
1. #include <stdio.h>
2. void main()
3. {
4. int a[3] = {1, 2, 3};
5. int *p = a;
6. int **r = &p;
7. printf("%p %p", *r, a);
8. }
a) Different address is printed
b) 1 2
c) Same address is printed.
d) 1 1
View Answer
Answer:c
6. How many number of pointer (*) does C have against a pointer variable declaration?
a) 7
3
b) 127
c) 255
d) No limits.
View Answer
Answer:d
7. What is the output of this C code?
1. #include <stdio.h>
2. int main()
3. {
4. int a = 1, b = 2, c = 3;
5. int *ptr1 = &a, *ptr2 = &b, *ptr3 = &c;
6. int **sptr = &ptr1; //-Ref
7. *sptr = ptr2;
8. }
a) ptr1 points to a
b) ptr1 points to b
c) sptr points to ptr2
d) None of the mentioned
View Answer
Answer:b
8. What is the output of this C code?
1. #include <stdio.h>
2. void main()
3. {
4. int a[3] = {1, 2, 3};
5. int *p = a;
6. int **r = &p;
7. printf("%p %p", *r, a);
8. }
a) Different address is printed
b) 1 2
c) Same address is printed.
d) 1 1
View Answer
Answer:c
剩余77页未读,继续阅读
苗苗小姐
- 粉丝: 37
- 资源: 328
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0