c - Codeblocks vs GCC different output (strange behavior)? -


I was trying to answer and after writing this code

  #include & lt; Stdio h & gt; # Include & lt; Stdlib.h & gt; # Include & lt; Time.h> # Include & lt; Math.h> Int M = 10; Int n = 30; Int Q = 10; Structure element {int * i; Int * j; Int k; }; Structure element * create_structure (); Zero print_elment (strip element *); Compare Int (Constant Worth *, Constant Wide *); Zero type (structure element *); // changed the return value of the order to zero // because the argument will be changed directly because it is a // pointer index main () {srand (time (NULL)); Structure element * list; List = create_structure (); Printf ("\ n --------- --- --- --------- \ n \ n"); Print_element; Printf ("\ N --------------------------- \ n"); Type (list); Print_element; Return 0; } Structure element * create_structure () {int aux1 = 0, count = 0; Structure element * structure; // Allocation of structure indicator structure changed = = (strip element *) maulok (strip element); Structure & gt; K = k, structure-> I = (int *) malloc (s * s (int)); Structure-> J = (int *) molk (k * sif (int)); For (calculation = 0; calculation & lt; K; count ++) {aux1 = rand ()% N; // We have only placed the first aux1 and it has two arrays (structure-> i) [count] = aux1; (Structure> J) [count] = aux1; } Return (structure); } Zero print_ element (Structure Element * Lista) {int count = 0; (Count = 0; count & lt; K; count ++) {printf ("row =% 2d:% 2d% 2d \ n", count + 1, (lista-> i) [count], (lista -> J) [count]); }} Compare the values ​​(CONST WASTE * A, CONCRETE WOID * B) {// EXER RETURN * (Int *) A - * (Int *) Compare the values ​​of two array parameters, indicated by B; } Zero Sort (Structure Element * List) {// We will sort arrays ordered by array which is function qsort (list-> i, K, Sizeof (int), compare); }  

I realized that compiling it with the terminal with the gcc command gives the right output, but using CodeBlox v13.12, the same internal GNU GCC uses compiler, gives wrong output !!

GCC command outlook: GCC-g-val main - Oaxx

GCC version 4.8. 2-19ubuntu1)

--------- --- ---------- line = 1: 8 8 lines = 2: 29 29 lines = 3: 9 row = 4: 11 11 line = 5: 20 20 row = 6: 21 21 line = 7: 4 4 line = 8: 16 16 line = 9: 9 line = 10: 2 2---- ----------------------- Line = 1: 2 8 Line = 2: 4 29 Line = 3: 8 9 Line = 4: 9 11 Line = 5 : 9 20 line = 6: 11 21 line = 7: 16 4 line = 8: 20 16 line = 9: 21 9 line = 10: 2 2 Note ( Please note the number of start line 3 )
  line = 3: 20 20 line = 4: 4 4 line = 5: 13 13 line = 6: 8 8 rows = 7: 4 4 rows = 8: 7 7 rows = 9: 21 21 rows = 10: 12 12 ----------------- ------- --- Row = 1: 4 24 Row = 2: 4 22 Row = 3: 7 20 Row = 4: 8 4 Row = 5: 12 13 Row = 6: 13 Row = 7: 20 4 Row = 8: 21 7 Rows = 9: 22 21 Rows = 10: 24 12  

Image Details Here Enter

So I was wondering what would be the kind of behavior What is it? I have tried to use the code in my code :: block (windows 8, code :: blocks 13.12).

"post-text" itemprop = "text">

, GCC 4.7.1), writes this product properly! It may happen, that your terminal emulator program is cropping out of output (or some with these lines)

After posting a screenshot, I now confirm this.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -