美文网首页
code snippet test.md

code snippet test.md

作者: Damon_S | 来源:发表于2017-12-06 20:43 被阅读7次

    很容易看出来,简书的Markdown格式文档不支持代码高亮

    我是一段C代码

    #include <stdio.h>
    
    int main() {
        /**
         * 定义一个指针变量
         * 指针变量是一个值为另一个变量的地址的变量
         * 在变量名称前加一个*用来声明指针变量
         * 指针变量的类型是指针指向的变量的值的类型
         * *用来读取指针变量存储的地址内存储的值
         */
        int *ip;
        int foo=20;
    
        /**
         * 把变量的地址赋值给指针
         */
        ip=&foo;
    
        printf("Address of foo variable: %p\n",&foo);
        printf("Variable stored in ip variable: %p\n",ip);
    
        /**
         * 访问指针变量中可用地址的值
         */
        printf("Value of *ip variable: %d\n",*ip);
        return 0;
    }
    

    我是一段PHP代码

    <?php
    /**
     * 冒泡排序 升序排列
     * @param array $haystack
     * @return array
     */
    function bubbleSort($haystack = [])
    {
        $len = count($haystack);
        for ($k = 1; $k < $len; $k++) {
            for ($j = 0; $j < $len - $k; $j++) {
                if ($haystack[$j] > $haystack[$j + 1]) {
                    $temp = $haystack[$j + 1];
                    $haystack[$j + 1] = $haystack[$j];
                    $haystack[$j] = $temp;
                }
            }
        }
        return $haystack;
    }
    
    $foo = [4,3,5,7,3,1];
    print_r(bubbleSort($foo));
    

    我是一段JS代码

    console.log("Hello World!");
    

    相关文章

      网友评论

          本文标题:code snippet test.md

          本文链接:https://www.haomeiwen.com/subject/njglixtx.html