the index appears to be out of bound code example

Example: error in array

#include <stdio.h>
int main()
{
	char a[20],b[10]= "String",c[8]={'S','t','r','i','n','g','\0'};
	int i;
	for(i=0;c[i]!='\0';i++){
	
	printf("%c",&c[i]);}
	printf("%s",b);
    puts(b);
    	printf("enter the string first scanf and then gets");
    	scanf("%s",a);
    	gets(a);
}#include <stdio.h>
int main()
{
	char a[20],b[10]= "String",c[8]={'S','t','r','i','n','g','\0'};
	int i;
	for(i=0;c[i]!='\0';i++){
	
	printf("%c",&c[i]);}
	printf("%s",b);
    puts(b);
    	printf("enter the string first scanf and then gets");
    	scanf("%s",a);
    	gets(a);
}

Tags:

Java Example