Is this a bug ?

is this a bug in the compiler ???

this doesn't compile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>

typedef struct {
	unsigned int HH,MM,DD;
} Jam;

int main(){

	Jam JamAwal;
	Jam JamAkhir;
	unsigned int Durasi;

	scanf("%d%d%d", &JamAwal.HH, &JamAwal.MM, &JamAwal.DD );
	scanf("%d%d%d", &JamAkhir.HH, &JamAkhir.MM, &JamAkhir.DD );
	Durasi = (JamAKhir.HH * 3600 + JamAKhir.MM * 60 + JamAkhir.DD) - (JamAwal.HH * 3600 + JamAwal.MM * 60 + JamAwal.DD);

	printf("%d\n", Durasi);
	
	return 0;
}


but this does

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>


typedef struct {
	unsigned int HH,MM,DD;
} Jam;

int main(){

	Jam JamAwal;
	Jam JamAkhir2;
	unsigned int Durasi;

	scanf("%d%d%d", &JamAwal.HH, &JamAwal.MM, &JamAwal.DD );
	scanf("%d%d%d", &JamAkhir2.HH, &JamAkhir2.MM, &JamAkhir2.DD );
	Durasi = (JamAkhir2.HH * 3600 + JamAkhir2.MM * 60 + JamAkhir2.DD) - (JamAwal.HH * 3600 + JamAwal.MM * 60 + JamAwal.DD);

	printf("%d\n", Durasi);



	return 0;
}



the only this that change is JamAkhir to JamAkhir2 variable name change

the error is
1
2
.\P01_13514090_01c.c: In function 'int main()':
.\P01_13514090_01c.c:33:12: error: 'JamAKhir' was not declared in this scope



my compiler is
1
2
3
4
g++.exe (GCC) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C++ is case-sensitive, so JamAkhir and JamAKhir are not related.

Also, your compiler is significantly outdated - I recommend updating to GCC 5.1 at least. If you are on 64-bit Windows, use nuwen MinGW:
http://nuwen.net/mingw.html
Last edited on
Topic archived. No new replies allowed.