online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> // ์˜ค๋ฆ„์ฐจ์ˆœ ๋ฒ„๋ธ”์†ŒํŠธ ํ•จ์ˆ˜ ์ •์˜ void bubbleSortAscending(int arr[], int n){ for (int i = 0; i < n - 1; i++){ // ์ „์ฒด n-1๋ฒˆ ๋ฐ˜๋ณต for (int j = 0; j < n - i - 1; j++){ // ์ด๋ฏธ ์ •๋ ฌ๋œ ๋’ท๋ถ€๋ถ„์„ ์ œ์™ธํ•˜๊ณ  ๋ฐ˜๋ณต if (arr[j] > arr[j + 1]){ // ์ธ์ ‘ํ•œ ๋‘ ๊ฐ’ ๋น„๊ต, ์•ž์ด ํฌ๋ฉด ๊ตํ™˜ // j < n - i - 1; ๋กœ ๋ณ€๊ฒฝํ•˜๋ฉด ๋‚ด๋ฆผ์ฐจ์ˆœ(Descending)์œผ๋กœ ๋ณ€๊ฒฝ int temp = arr[j]; // ์ž„์‹œ ๋ณ€์ˆ˜์— arr[j] ์ €์žฅ arr[j] = arr[j + 1]; // arr[j]์— arr[j+1] ๊ฐ’ ์ €์žฅ arr[j + 1] = temp; // arr[j+1]์— ์›๋ž˜ arr[j] ๊ฐ’ ์ €์žฅ } } } } int main(){ // ํ”„๋กœ๊ทธ๋žจ ์‹œ์ž‘ int arr[] = {7, 4, 5, 1, 3}; // ์ •์ˆ˜ํ˜• ๋ฐฐ์—ด ์„ ์–ธ ๋ฐ ์ดˆ๊ธฐํ™” int n = sizeof(arr) / sizeof(arr[0]); // ๋ฐฐ์—ด์˜ ์ „์ฒด ์š”์†Œ ๊ฐœ์ˆ˜ ๊ณ„์‚ฐ printf("์ดˆ๊ธฐ ์ƒํƒœ ๋ฐฐ์—ด: [ "); // ์ดˆ๊ธฐ ๋ฐฐ์—ด ์ถœ๋ ฅ for (int i = 0; i < n; i++) // ๋ฐฐ์—ด ์š”์†Œ ์ˆœ์ฐจ ์ถœ๋ ฅ printf("%d ", arr[i]); printf("] \n"); bubbleSortAscending(arr, n); // ๋ฒ„๋ธ” ์ •๋ ฌ ํ•จ์ˆ˜ ํ˜ธ์ถœ printf("์ •๋ ฌ๋œ ๋ฐฐ์—ด: [ "); // ์ •๋ ฌ๋œ ๋ฐฐ์—ด ์ถœ๋ ฅ for (int i = 0; i < n; i++) // ๋ฐฐ์—ด ์š”์†Œ ์ˆœ์ฐจ ์ถœ๋ ฅ printf("%d ", arr[i]); printf("] \n"); return 0; // ํ”„๋กœ๊ทธ๋žจ ์ข…๋ฃŒ }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue