C语言
-
C示例用于反转String的程序-C语言实例教程|
C示例用于反转String的程序 #include stdio.h int main () { char s1 [] = TajMahal ; // String Given char s2 [ 8 ]; // Variable to store reverse string int length = 0 ; int loo...
-
C语言全局变量-C语言基础教程实例源码|
C语言全局变量 /* global.c -- uses an external variable */ #include stdio.h int units = 0 ; /* an external variable */ void critic ( void ); int main ( void ) { extern int unit...
-
C示例复制字符串的程序-C语言实例教程|
C示例复制字符串的程序 #include stdio.h int main () { char s1 [] = TajMahal ; // String Given char s2 [ 8 ]; // Variable to hold value int length = 0 ; while ( s1 [ length ...
-
C语言局部静态变量-C语言基础教程实例源码|
C语言局部静态变量 /* loc_stat.c -- using a local static variable */ #include stdio.h void trystat ( void ); int main ( void ) { int count ; for ( count = 1 ; count = 3 ; cou...
-
C示例排序字符串字符的程序-C语言实例教程|
C示例排序字符串字符的程序 #include stdio.h #include string.h int main ( void ) { char string [] = simplyeasylearning ; char temp ; int i , j ; int n = strlen ( string );...
-
C语言变量作用域-C语言基础教程实例源码|
C语言变量作用域 // forc99.c -- new C99 block rules #include stdio.h int main () { int n = 8 ; printf ( Initially, n = %d at %p , n , n ); for ( int n = 1 ; n 3 ; n ++ ) print...
-
C语言字符串转换为数字实例-C语言基础教程实例源码|
C语言字符串转换为数字实例 /* strcnvt.c -- try strtol() */ #include stdio.h #include stdlib.h #define LIM 30 char * s_gets ( char * st , int n ); int main () { char numbe...
-
C示例计算元音的程序-C语言实例教程|
C示例计算元音的程序 #include stdio.h int main () { char s [] = TajMahal ; // String Given int i = 0 ; int vowels = 0 ; // Vowels counter int consonants = 0 ; // Consonants ...
-
C语言命令行参数实例-C语言基础教程实例源码|
C语言命令行参数实例 /* repeat.c -- main() with arguments */ #include stdio.h int main ( int argc , char * argv []) { int count ; printf ( The command line has %d arguments:...
-
C实例计算字符-C语言实例教程|
C实例 计算字符 #include stdio.h int main () { char s [] = TajMahal ; // String Given char ch = a ; // Character to count int i = 0 ; int count = 0 ; // Counter while ( s [ i ]...
-
C语言修改字符串实例-C语言基础教程实例源码|
C语言修改字符串实例 /* mod_str.c -- modifies a string */ #include stdio.h #include string.h #include ctype.h #define LIMIT 81 void ToUpper ( char * ); int PunctCount ( cons...
-
C实例不使用函数计算字符串长度-C语言实例教程|
C实例 不使用函数计算字符串长度 #include stdio.h int main () { char s1 [] = TajMahal ; int i = 0 ; while ( s1 [ i ] != � ) { i ++ ; } printf ( Length of string %s is ...
-
C语言字符串排序-C语言基础教程实例源码|
C语言字符串排序 /* sort_str.c -- reads in strings and sorts them */ #include stdio.h #include string.h #define SIZE 81 /* string length limit, including � */ #define LIM 20...
-
C实例打印单个字符-C语言实例教程|
C实例 打印单个字符 #include stdio.h int main () { char str [] = Hello World ; printf ( %s , str ); return 0 ; }...
-
C语言使用sprintf格式化字符串-C语言基础教程实例源码|
C语言使用sprintf格式化字符串 /* format.c -- format a string */ #include stdio.h #define MAX 20 char * s_gets ( char * st , int n ); int main ( void ) { char first [ MAX ];...
-
C实例打印字符串-C语言实例教程|
C实例 打印字符串 #include stdio.h int main () { char str [] = Hello World ; printf ( %s , str ); return 0 ; }...
-
C语言字符串拷贝实例-C语言基础教程实例源码|
C语言字符串拷贝实例 /* copy3.c -- strncpy() demo */ #include stdio.h #include string.h /* declares strncpy() */ #define SIZE 40 #define TARGSIZE 7 #define LIM 5 char * s_ge...
-
C实例连接数组-C语言实例教程|
C实例 连接数组 #include stdio.h int main () { int array [ 10 ]; int even [ 5 ] = { 0 , 2 , 4 , 6 , 8 }; int odd [ 5 ] = { 1 , 3 , 5 , 7 , 9 }; int loop , index , e_len , o_len...
-
C示例分割数组的程序-C语言实例教程|
C示例分割数组的程序 #include stdio.h int main () { int array [ 10 ] = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 }; int even [ 10 ], odd [ 10 ]; int loop , e , d ; e = d = 0 ;...
-
C语言strncmp实例-C语言基础教程实例源码|
C语言strncmp实例 /* starsrch.c -- use strncmp() */ #include stdio.h #include string.h #define LISTSIZE 6 int main () { const char * list [ LISTSIZE ] = { astronomy , astounding ...