Angel David Yaguana Hernandez
/
CPP_strncmp
strncmp, descripcion y ejemplo
Revision 0:7ab6d00922fa, committed 2012-04-03
- Comitter:
- sherckuith
- Date:
- Tue Apr 03 21:05:19 2012 +0000
- Commit message:
- strncmp, descripcion y ejemplo
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 7ab6d00922fa main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Apr 03 21:05:19 2012 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" +/* strncmp example */ +#include <stdio.h> +#include <string.h> + +int main () +{ + char str[][5] = { "R2D2" , "R2PO" , "R2A6", "R2xx" }; + int n; + puts ("Looking for R2 astromech droids..."); + for (n=0 ; n<4 ; n++)// 4 es numero de elementos + if (strncmp (str[n],"R2xx",2) == 0) + { + printf ("found %s\n",str[n]); + } + return 0; +} \ No newline at end of file
diff -r 000000000000 -r 7ab6d00922fa mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Apr 03 21:05:19 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479