PDA

View Full Version : سوال: ایجاد خطا در کامپایلر TC



unsung
یک شنبه 20 اردیبهشت 1388, 12:13 عصر
سلام

من نمیدونم چرا هر برنامه ای رو میخوام اجرا کنم با TC همش از این خط اررور میگیره


/* Copyright (c) 2009 the authors listed at the following URL, and/or
the authors of referenced articles or incorporated external code:
http://en.literateprograms.org/Merge_sort_(C)?action=history&offset=20060514200945
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Retrieved from: http://en.literateprograms.org/Merge_sort_(C)?oldid=4743
*/
#include <string.h>
#include <time.h> /* time() */
#include <stdlib.h> /* rand() */
#include <stdio.h> /* puts() */
#define MIN_MERGESORT_LIST_SIZE 32

void mergesort_array(int a[], int size, int temp[]) {
int i1, i2, tempi;
if (size < MIN_MERGESORT_LIST_SIZE) {
/* Use insertion sort */
int i;
for (i=0; i < size; i++) {
int j, v = a[i];
for (j = i - 1; j >= 0; j--) {
if (a[j] <= v) break;
a[j + 1] = a[j];
}
a[j + 1] = v;
}
return;
}
mergesort_array(a, size/2, temp);
mergesort_array(a + size/2, size - size/2, temp);
i1 = 0;
i2 = size/2;
tempi = 0;
while (i1 < size/2 && i2 < size) {
if (a[i1] < a[i2]) {
temp[tempi] = a[i1];
i1++;
} else {
temp[tempi] = a[i2];
i2++;
}
tempi++;
}
while (i1 < size/2) {
temp[tempi] = a[i1];
i1++;
tempi++;
}
while (i2 < size) {
temp[tempi] = a[i2];
i2++;
tempi++;
}
memcpy(a, temp, size*sizeof(int));
}

int main(int argc, char* argv[]) {
int size = atoi(argv[1]);
int* a = malloc(sizeof(int)*size);
int* temp = malloc(sizeof(int)*size);
int i;
srand(time(NULL));
for(i=0; i<size; i++) {
a[i] = rand() % size;
}
mergesort_array(a, size, temp);
for(i=1; i<size; i++) {
if (!(a[i-1] <= a[i])) {
puts("ERROR");
return -1;
}
}
puts("SUCCESS");
return 0;
}



از خط include که همش میگه Decelration syntax error :ناراحت:

یکی راهنماییم کنه لطفآ

mg_mahyar
یک شنبه 20 اردیبهشت 1388, 13:06 عصر
شلید توی محیط win 32 project مینویسی!!1