Skip to content

Instantly share code, notes, and snippets.

@jmramirezpro
Created January 21, 2016 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmramirezpro/b356e3fc54cd034d8a10 to your computer and use it in GitHub Desktop.
Save jmramirezpro/b356e3fc54cd034d8a10 to your computer and use it in GitHub Desktop.
/*
* Cadena2.c
* Solución a los ejercicios del podcast Codigo Fuente - Programa 18
* Programa que hace operaciones erroneas con strings por la declaración de tamaño
* insuficiente de los mismos
* Creado el 13 de ene. de 2016
* Author: jmramirez
*/
#include <stdio.h>
#include <string.h>
int main(void)
{
char cadena [10];
int i = 3;
strcpy (cadena, "Esto es un error");
printf("Cadena es: %s\n", cadena);
for (i=0; i< strlen(cadena); i++){
printf ("El elemento %d de cadena es %c\n", i, cadena[i]);
}
return(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment