Angel David Yaguana Hernandez
/
CPP_strncmp
strncmp, descripcion y ejemplo
main.cpp
- Committer:
- sherckuith
- Date:
- 2012-04-03
- Revision:
- 0:7ab6d00922fa
File content as of revision 0:7ab6d00922fa:
#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; }