Home IT Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ C language preprocessor command     - Custom Android UI template Comments (Programming)

- Linux Learning --- disk partition / relational representation + mount (Linux)

- Installation on Ubuntu class Winamp audio player Qmmp 0.9.0 (Linux)

- Six Ways to view slides can be implemented Android (Programming)

- ORA-12545: Connection failed because the target host or object does not exist (Database)

- Linux Getting Started tutorial: Experience KVM Virtual Machine chapter (Linux)

- [Android] Eclipse does not update the Android SDK Manager solution [using GoAgent] (Programming)

- Linux, how to filter, split, and merge pcap file (Linux)

- Design and implementation of environment sniffer running under Linux (Linux)

- Use CutyCapt to convert HTML pages to png images on Linux (Linux)

- Linux Security (Linux)

- Java polymorphic methods inside constructors complete analysis (Programming)

- Oracle 11g maintenance partitions (eight) - Renaming Partitions (Database)

- Linux can modify the maximum number of open files (Linux)

- Use Mop monitor stock prices at the Linux command line (Linux)

- Zabbix using Omsa monitor hardware information of Dell server (Server)

- Using iptables achieve NAT (Linux)

- Linux cron job (crontab) Examples (Linux)

- numpy and SciPy installation under Python for scientific computing package (Linux)

- MongoDB 2.6 deployment replica set + partitions (Database)

  C language preprocessor command
  Add Date : 2017-04-13      
  The first step in dealing with C language compiler after the pretreatment, is to deal with the .c file .i file. When the compiler to do some preprocessing expand the replacement process.

1> header file to start soon #include "stdio.h" file similar expanded.

2> macro definition replacement work, the program is about to replace the contents of the macro definition good.

#include "stdio.h"

#define R 10

int main ()


    int a = R;


After preprocessor code changes

//...stdio.h contents of not showing

// Place the macro definition has been replaced in the program

int main ()


    int a = 10;
return 0;


Replace macro to do is replace a whole, and syntax-independent, it does not follow the rules of grammar.

Macro definitions generally used in two ways, one is to define a constant, and the other is to define a macro function.

#define N (n, m) n + m // macro definition

int main ()


        int c;

        c = N (1,2); // sum of 1 and 2
return 0;


In fact, after pre-treatment becomes

int main ()


    int c;

    c = 1 + 2;
return 0;


Another application macro function, because the macro syntax definition does not consider it just as a whole substitution, so you can write without considering the type of function variables, and this is his advantage

For example, the following code:

#define N (n, m) n + m // macro definition

int main ()


    int e = N (10,20) * N (10,20) // After preprocessing is int e = 10 + 20 * 10 + 20;

// The above error is easy to count! !

    return 0;


3> Conditional Compilation: Some statements in the hope that when the conditions are met to compile.

#ifdef identifier

// Block 1


// Block 2


When the identifier has been defined, only 1 block compiled participate

At the same time of its use and define a replacement job is done.

With some knowledge of the C language. . . See the video to learn Linux C language.
- How to manage your to-do list with the Go For It on Ubuntu (Linux)
- Detailed Linux network security policies and protection measures (Linux)
- ARM runtime environment built from scratch using QEMU emulator (Linux)
- Ubuntu 14.10 Apache installation and configuration (Server)
- Linux command binlog by filtering out the complete SQL statement (Database)
- Summarize small problems encountered in the use Lua (Programming)
- Questions about Linux compiler u-boot (Programming)
- Use MySQL optimization of security to prevent misuse of aliases (Database)
- 10 easy to use Linux utilities Recommended (Linux)
- Ubuntu Linux installation GAMIT10.6 (Linux)
- MySQL binlog automatic cleanup script (Database)
- Mac OS X command line to submit the local project to Git (Server)
- Ora-00439: feature not enabled: managed standby (Database)
- Java reflection summary (Programming)
- VMware Workstation + Ubuntu 10.04 Download the Android 2.2 source code (Linux)
- iOS GCD multithreading simple to use (Programming)
- Hadoop new and old version of the difference in the size of the InputSplit (Server)
- Linux memory Cache Analysis (Linux)
- GRUB2 boot Ubuntu Manual (Linux)
- MySQL Data Types (Database)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.