小编Pet*_*ete的帖子

为什么这个C程序是梨形的?我打破了我的缓冲区吗?

我一直在尝试使用C语言.我通常使用PHP和JavaScript.

我做了"Hello World",然后输入了这个,我从某个网站复制了...

#include <stdio.h>
#include <stdlib.h>
#define MAX 20
int intcmp(const void*v1, const void *v2){
    return (*(int *)v1 - *(int *)v2);
}
main(){
    int arr[MAX], count, key , *ptr;
    printf("Enter %d integer values; press enter after each\n", MAX);
    for (count = 0; count < MAX; count++)
        scanf("%d", &arr[count]);
    puts("Press a key to sort the values");
    getc(stdin);

    qsort(arr, MAX, sizeof(arr[0]), intcmp);

    for(count=0; count < MAX; count++)
        printf("\narr[%d] = %d.", count, arr[count]);

    puts("\nPress a key to continue");
    getc(stdin);

    printf("Enter a val …
Run Code Online (Sandbox Code Playgroud)

c buffer-overflow

3
推荐指数
1
解决办法
159
查看次数

标签 统计

buffer-overflow ×1

c ×1