Segmentation fault (core dumped)
i cant figure out why this program i wrote this morning is giving me a seg fault
im also new here
Code:
#include<stdio.h> #include<string.h>
#include<unistd.h>
//simple program that takes data and then prints it :-)
int main() {
int i;
int x;
struct input {
char input1[9];
};
struct input inputa;
puts("this program accepts alot of input from your keyboard,9 chars");
sleep(2);
printf("enter your first string value\n");
scanf("%s",inputa.input1);
printf("enter your second value\n");
scanf("%s",inputa.input1);
printf("enter your third value\n");
scanf("%s",inputa.input1);
printf("enter your fourth string value\n");
scanf("%s",inputa.input1);
printf("enter your fifth value\n");
scanf("%s",inputa.input1);
printf("enter your 6th value\n");
scanf("%s",inputa.input1);
printf("enter your 7th string value\n");
scanf("%s",inputa.input1);
printf("enter your 8th value\n");
scanf("%s",inputa.input1);
printf("enter your 9th value\n");
scanf("%s",inputa.input1);
sleep(2);
printf("now it will print out all the ........ you just typed above!\n");
for(x=0;x<9;x++)
printf("%s\n\n",inputa.input1[x]);
printf(" DIDNT FEEL LIKE IT HAHAHAHAHAHAHAHA(JK)");
return(0);
}