1. 程式人生 > >兩個好玩的C語言程式

兩個好玩的C語言程式

同學考我的一道題。

1.寫一個c語言程式,輸出hello,刪掉程式碼的第一個字元,輸出world。

2.寫一個c語言程式,輸出hello,刪掉程式碼的最後一個字元,輸出world。

想了一會,寫出了這兩個程式碼,哈哈,再次膜拜一下c語言的語法。

Think time

//*
#define CQSB
//*/
#include<stdio.h>
int main()
{
    int a=0;
    #ifdef CQSB
    puts("hello");
    a=1;
    #endif
    if(!a) puts("world");
    return 0;
}
#include<stdio.h>
#define pp main(){puts("hello");}
#define p main(){puts("world");}
pp