04-14-2015, 11:16 AM 
		
	
	
		hi i am trying to learn to program in c. and is using this guide. C Programming in Linux © David Haskins 2008
now at chapter2_1.c i got in to a problem the compelling will not run and I can not see what's wrong, is there som help to get?
	
	
	
	
	
now at chapter2_1.c i got in to a problem the compelling will not run and I can not see what's wrong, is there som help to get?
Code:
#include <stdio.h>
#DEFINE STRINGSIZE 256
int main(int argc, char*argv[])
{
    char town[STRINGSIZE]="Guildford";
    char county[STRINGSIZE]="Surrey";
    char country[STRINGSIZE]="Great Britain";
    int population=66773;
    float latitude=51.238599;
    float longitude=-0.566257;
    printf("Town name:%s population:%d\n",town,population);
        printf("County:%s\n",county);
     printf("Country:%s\n",country);
    printf("Location latitude:%f longitude: % f\n",latitude,longitude);
          printf("char=%d byte int=%d bytes float=%d bytes\n",
    sizeof(char),sizeof(int),sizeof(float));
    printf("memory used:%d bytes\n",
        ((STRINGSIZE*3) * sizeof(char)) + sizeof (int) + (2 * sizeof(float)));
      
         return 0;Code:
Programming_In_Linux$ gcc -o data1 chapter2_1.c -lc
chapter2_1.c:7:2: error: invalid preprocessing directive #DEFINE
 #DEFINE STRINGSIZE 256
  ^
chapter2_1.c: In function ‘main’:
chapter2_1.c:11:12: error: ‘STRINGSIZE’ undeclared (first use in this function)
  char town[STRINGSIZE]="Guildford";
            ^
chapter2_1.c:11:12: note: each undeclared identifier is reported only once for each function it appears in
chapter2_1.c:22:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
  sizeof(char),sizeof(int),sizeof(float));
  ^
chapter2_1.c:22:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat=]
chapter2_1.c:22:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
 
 

 




