0

I'm trying to sort and print out the results, but it is showing nothing. I'm sure my implementation of bubble sort is correct. Where do you think is the error?

I also modified the helpers.h to include stdio.h' andhelpers.c` to also include it. There is no compile error. It won't just really work properly.

for (int k = 0; k < 10; k++) {
    printf("%c\\n", values[k]);
}
  • are you sure you should use the %c to print out an int value? also are you sure the escape sequence for a newline is \\n? – Kareem Jan 10 '16 at 13:24
  • oh god. AHHAHAHAHAHA thanks will correct it now. fuuu. – Michael Daryl Mayo Jan 10 '16 at 13:50
  • any mod to mark this as close? I already fixed my program. thanks kareem! basic mistakes. – Michael Daryl Mayo Jan 10 '16 at 13:57
  • posted it as an answer. you can now accept the answer below by hitting the check mark! – Kareem Jan 10 '16 at 14:05
1

the answer is definitely to use the correct format specifier for a value of type int.

0

Did you store the values as ints? That would make the most sense. Try using %i as opposed to %c.

for (int k = 0; k < 10; k++) {
    printf("%i\\n", values[k]);
}

If for some reason the values are chars, try checking if the values exist by using debug50 and clicking the array in the dropdown menu.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .