:TRICK-MAN:™ FOREVER, Since 2007  
Front Page
Tag | Location | Media | Guestbook | Admin   
 
임베디드 개발자를 위한 C
임베디드 개발자라면 기본적으로 알아야 할 것들을 정리한 것입니다.(출처가 생각이 안남)
후배 사원에게 한 번 풀어보라고 했는데 생각보다 점수가 잘(?) 안 나왔어요...
아주 간단하지만 아주 기초적으로 알아야 할 것들만 모았네요. 

Preprocessor 
1. Using the #define statement, how would you declare a manifest constant that returns the number of seconds in a year? Disregard leap years in your answer. 
 
2. Write the "standard" MIN macro-that is, a macro that takes two arguments and returns the smaller of the two arguments. 
 
3. What is the purpose of the preprocessor directive #error? 

Infinite loops 
4. Infinite loops often arise in embedded systems. How does you code an infinite loCandidates who propose this are either assembly language programmers (which is probably good), or else they are closet BASIC/FORTRAN programmers looking to get into a new field. 

Data declarations 
5. Using the variable a, give definitions for the following: 
a) An integer 
b) A pointer to an integer 
c) A pointer to a pointer to an integer 
d) An array of 10 integers 
e) An array of 10 pointers to integers 
f) A pointer to an array of 10 integers 
g) A pointer to a function that takes an integer as an argument and returns an integer 
h) An array of ten pointers to functions that take an integer argument and return an integer 

Static 
6. What are the uses of the keyword static? 

Const 
7. What does the keyword const mean? 

What do the following declarations mean? 
const int a;
int const a;
const int *a;
int * const a;
int const * a const;

Bit manipulation 
8. Embedded systems always require the user to manipulate bits in registers or variables. Given an integer variable a, write two code fragments. The first should set bit 3 of a. The second should clear bit 3 of a. In both cases, the remaining bits should be unmodified. 

Accessing fixed memory locations 
9. Embedded systems are often characterized by requiring the programmer to access a specific memory location. On a certain project it is required to set an integer variable at the absolute address 0x67a9 to the value 0xaa55. The compiler is a pure ANSI compiler. Write code to accomplish this task. 

Code examples 
10. What does the following code output and why? 
void foo(void)
{
  unsigned int a = 6;
  int b = -20;
  (a+b > 6) ? puts("> 6") : puts("<= 6");
}

Typedef 
11. Typedef is frequently used in C to declare synonyms for pre-existing data types. It is also possible to use the preprocessor to do something similar. For instance, consider the following code fragment: 
 
#define dPS struct s *
typedef struct s * tPS;
 
The intent in both cases is to define dPS and tPS to be pointers to structure s. Which method, if any, is preferred and why? 

Obscure syntax 
12. C allows some appalling constructs. Is this construct legal, and if so what does this code do? 
int a = 5, b = 7, c;
c = a+++b;




BLOG main image
jskwak[@]gmail.com 또는 ♬♬♬ jskwak[@]trickman.net, ▷◁▷◁ http://about.me/jskwak
 Notice
반/갑/습/니/다
곽/자/섭 입니다...
 Category
분류 전체보기 (151)
전송기술 (53)
이더넷 (3)
시스코자격증 (7)
임베디드 (4)
책읽기 (8)
주절주절 (70)
MAC OS X Life (1)
 TAGS
Linux 구글 CRT CDP ip 절체 CISCO 코드검색 SDH 아이팟 FRT 대립해소도 메모 CCNA T-SDN ITU-T OTN 모공 OSX BLSR toc UPSR CCNP 구름 1588 Telecom Profile SONET
 Calendar
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
 Recent Entries
 Recent Comments
 Archive
 Link Site
[01] 지원,지민 놀이터
 Visitor Statistics
Total :
Today :
Yesterday :
rss