C 记录

为什么调用 sqrt 函数报错显示未定义

一、调用此函数时,要先引用头文件:
#include <math.h>
二、linux gcc 编译时,如果用到了 math中的函数,要手工加入函数库链接:-lm,即:
gcc -o tt your_prog.c -lm

    /*
	* 注意字符串的结束符 也要占已字节 否则 如果把 char str2[][11] 改成 char str2[][5]
	* $ ./a.exe
	* 123456789101112
	* 6789101112
	* 01112
	*/
	char str2[][11] = {"12345","67891","01112"};
	printf("%s
",str2[0]);
	printf("%s
",str2[1]);
	printf("%s
",str2[2]);

  

原文地址:https://www.cnblogs.com/cgjcgs/p/4731336.html