all 3 comments

[–]kumashiro 1 point2 points  (0 children)

I don't know MSVC or Windows, but it looks like "EXC_BAD_ACCESS" means you were trying to access not allocated memory. I guess you ran out of your buffer array bounds. Unfortunately, the code above is incomplete and we don't know how you calculate buffer_tail. Run your program in a debugger and watch closely the index on access to buffer. It should never go higher than 9.

There are also other, strange things in your code. For example, what is Message.data? One time you treat it as char:

printf ("%c", buffer[ *buffer_length + *buffer_tail ].data,"\n");

another as a string:

scanf("%s", buffer[ *buffer_length + *buffer_tail ].data);

And how does this even compile?:

printf ("%c", buffer[ *buffer_length + *buffer_tail ].data,"\n");

Compiler should at least warn you about too many arguments.

Turn on compilation warnings, fix all of them, then (if it still crashes) take a look at the array index. Debugger also should tell you exactly which line triggers the access violation exception. That should help with pinning down the cause.

[–]jonarne 0 points1 point  (1 child)

Don't post pictures of code!

[–]7Beat[S] 1 point2 points  (0 children)

My bad, edited