strncmp, descripcion y ejemplo
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 /* strncmp example */ 00003 #include <stdio.h> 00004 #include <string.h> 00005 00006 int main () 00007 { 00008 char str[][5] = { "R2D2" , "R2PO" , "R2A6", "R2xx" }; 00009 int n; 00010 puts ("Looking for R2 astromech droids..."); 00011 for (n=0 ; n<4 ; n++)// 4 es numero de elementos 00012 if (strncmp (str[n],"R2xx",2) == 0) 00013 { 00014 printf ("found %s\n",str[n]); 00015 } 00016 return 0; 00017 }
Generated on Sat Jul 16 2022 19:17:04 by
1.7.2