about *ptr-arr here is the debug code. Hope you figure this out need to sleep now. Sorry for no comments i can do it later if there are questions.

#include<stdio.h>

int main()
{
        static int arr[]={0,1,2,3,4};
        int *p[]={arr,arr+1,arr+2,arr+3,arr+4};
        int **ptr=p;
        printf("size of int %d\n", sizeof(int));
        printf("ptr before changes %d\n", ptr);
        printf("p before changes %d\n", p);
        printf("arr before changes %d\n", arr);
        printf("*ptr before changes(points to arr) %d\n", *ptr);
        ptr++;
        printf("ptr after increment %d\n", ptr);
        printf("*ptr after increment(arr+1) %d\n", *ptr);
        printf("\n How many separate ptr and p [%d] %d %d \n",ptr-p,*ptr-arr,**ptr);
        *ptr++;
        printf("\n %d %d %d \n",ptr-p,*ptr-arr,**ptr);
        *++ptr;
        printf("\n %d %d %d \n",ptr-p,*ptr-arr,**ptr);
        ++*ptr;
        printf("\n %d %d %d \n",ptr-p,*ptr-arr,**ptr);
        return 0;
}

http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence
http://www.cs.umd.edu/class/spring2003/cmsc311/Notes/BitOp/pointer.html

Dont be afraid to add as much printf as possible.

When you subtract two pointers, as long as they point into the same array, the result is the number of elements separating them and in this case each int is 4 byte for example.. then you get this otput on my pc:
size of int 4
ptr before changes 2293496
p before changes 2293496
ptr after increment 2293500

How many separate ptr and p [1] 1 1

2 2 2

3 3 3

3 4 4

Process returned 0 (0x0) execution time : 0.029 s
Press any key to continue.

#include<stdio.h>

int main()
{
        static int arr[]={0,1,2,3,4};
        int *p[]={arr,arr+1,arr+2,arr+3,arr+4};
        int **ptr=p;
        printf("size of int %d\n", sizeof(int));
        printf("ptr before changes %d\n", ptr);
        printf("p before changes %d\n", p);
        ptr++;
        printf("ptr after increment %d\n", ptr);
        printf("\n How many separate ptr and p [%d] %d %d \n",ptr-p,*ptr-arr,**ptr);
        *ptr++;
        printf("\n %d %d %d \n",ptr-p,*ptr-arr,**ptr);
        *++ptr;
        printf("\n %d %d %d \n",ptr-p,*ptr-arr,**ptr);
        ++*ptr;
        printf("\n %d %d %d \n",ptr-p,*ptr-arr,**ptr);
        return 0;
}

Try otputing to another file instead of windows console and read, as i see you use dos include.
Please note that windows new line is not '\n' because it's one byte in linux LF and 2 byte in windows CR+LF please see http://en.wikipedia.org/wiki/Newline

please try different compiler maybe code blocks IDE or other

paste this into your file manager to test
c:\TurboC++\Disk\TurboC3\sample.txt

or use sameple.txt
and put it in same dir as your exe

looks like i flipped bmp image with this code, bot it changed color ))
also still meta data unknown
http://www.cs.pitt.edu/~kirk/cs1501/Ramirez/Spring2008/assigs/compression/data/tux-large.bmp

#include <stdio.h>
#include <time.h>
#include <stdlib.h>

int iCreateTestFile();
int iReverseImage(unsigned char *pucImageData, long lSize)
{
   FILE * pfOutputImage = NULL;
   long i = 0;
   long j = 0;
   unsigned char *pucReversedImage = (unsigned char*) malloc(lSize);

   i = lSize - 1;
   j = 100;
   while(j < lSize)
   {
      pucReversedImage[i] = pucImageData[j];
      j++;
      i--;
   }

   pfOutputImage = fopen("tux-large-reversed.bmp", "wb");
   fseek (pfOutputImage , 0 , SEEK_SET);
   fwrite(pucImageData, 1 , 100 , pfOutputImage);
   fseek (pfOutputImage , 100 , SEEK_SET);
   fwrite(pucReversedImage, 1 , lSize-100, pfOutputImage);
   fclose(pfOutputImage);
   free(pucReversedImage);
   return 0;
}

int main()
{  
   iCreateTestFile();

   return 0;
}

int iCreateTestFile()
{
   FILE *pfInputImage = NULL;
   long lSize = 0;
   unsigned char *pucImageData = NULL;

   pfInputImage = fopen("tux-large.bmp", "rb");
   fseek (pfInputImage , 0 , SEEK_END);
   lSize = ftell (pfInputImage);
   fseek (pfInputImage , 0 , SEEK_SET);
   pucImageData = (unsigned char*) malloc(lSize);
   fread(pucImageData, 1 , lSize, pfInputImage);

   if(pucImageData != NULL)
   {
      iReverseImage(pucImageData, lSize);
   }

   fclose(pfInputImage);
   free(pucImageData);
   return 0;
}

Maybe someone can help me understand how can i read metadata of the jpeg image on c as i understand there are some tags ?
Also is this data 2 byte not one byte to reverse >\?
I am using linux so maybe some library ?
Here is the code and i need to reverse image bot first determine metadata size not to reverse it..

Here is some code for image http://www.scs.ryerson.ca/~etabello/linux_icon.jpg

#include <stdio.h>
#include <time.h>
#include <stdlib.h>

int iCreateTestFile();
int iReverseImage(unsigned char *pucImageData, long lSize)
{
   FILE * pfOutputImage = NULL;
   long i = 0;
   long j = 0;
   unsigned char *pucReversedImage = (unsigned char*) malloc(lSize);

   i = lSize - 1;
   j = 0;
   while(j < lSize)
   {
      pucReversedImage[i] = pucImageData[j];
      j++;
      i--;
   }

   pfOutputImage = fopen("linux_icon_reversed.jpg", "wb");

   fwrite(pucReversedImage, 1 , lSize, pfOutputImage);
   fclose(pfOutputImage);
   free(pucReversedImage);
   return 0;
}

int main()
{  
   iCreateTestFile();

   return 0;
}

int iCreateTestFile()
{
   FILE *pfInputImage = NULL;
   long lSize = 0;
   unsigned char *pucImageData = NULL;

   pfInputImage = fopen("linux_icon.jpg", "rb");
   fseek (pfInputImage , 0 , SEEK_END);
   lSize = ftell (pfInputImage);
   fseek (pfInputImage , 0 , SEEK_SET);
   pucImageData = (unsigned char*) malloc(lSize);
   fread(pucImageData, 1 , lSize, pfInputImage);

   if(pucImageData != NULL)
   {
      iReverseImage(pucImageData, lSize);
   }

   fclose(pfInputImage);
   free(pucImageData);
   return 0;
}

are you shure you can use fgets ? why dont you use fread for start and try to copy image ?
You can also use some hex editor to compare values.

fgets is for text...

No, everyone has them, you need to be patient. Cheer up :)
Just always know that this is c language, there is no magic, if something does not work then you can find out why always. Add as much printf as you can to do that..
Like that

void checkcollision()
{
    float x1 = tanks[0].x;
    float y1 = tanks[0].y;
    float x2 = tanks[1].x;
    float y2 = tanks[1].y;
    float dist = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
    float dr = tanks[0].rad+tanks[1].rad;
    printf("dist: %f, radius+radius: %f\n",dist, dr);
    if(1 < 2)
    {
       puts("yes");
    }
    else
    {
       puts("wtf");
    }
    if(dist < dr) ;
    {
        printf("checkcollision read true\n");
        printf("dist: %f, radius+radius: %f\n",dist,dr);
        goback(0); goback(1);
    }
}

thank you. Am I the only one who has trouble seeing small problems in walls of text that comprise code? This is depressing.

if(dist<dr);
remove semicolon ?
should be or it will do nothing if dist < dr and do nothing on else

    if(dist<dr)
    {
        printf("checkcollision read true\n");
        printf("dist: %f, radius+radius: %f\n",dist,dr);
        goback(0); goback(1);
    }

did you try binary mode ?
http://www.cplusplus.com/reference/clibrary/cstdio/fread/
it should work very goot if you work with bytes.
for example - read whole file to buffer then run through all bytes and if byte is not 0 output to result buffer

It looks like it works, please explain better or post file.
Also, yes you should take hex editor to know exactly wat you are dealing with.. If it is not 8bit chars then you need to parse it differently..
check out dragon post
http://www.daniweb.com/software-development/c/threads/254246/how-to-read-unicode-utf-8-binary-file-line-by-line

the problem is that your code is impossible to copy cause of line numbers.
try to use malloc

#include "stdio.h"
#include "stdlib.h"
 void *gfunc_Realloc (void *i_oldObject_p, unsigned long i_objectSize)
 {
 /* Local variable *\
 \* -------------- */

 void *newObject_p;

 /* Code *\
 \* ---- */

 if(NULL == i_oldObject_p) {
 newObject_p = malloc(i_objectSize);
 } else {
 if (NULL == (newObject_p =
 realloc (i_oldObject_p,i_objectSize))) {
 printf("memory reallocation error\n");
 exit(1);
 }
 }
 return newObject_p;
}

int main()
{
   char *pcBuffer = NULL;
   while(1)
   gfunc_Realloc(pcBuffer, 500);
   return 0;
}

you reference wrong address, this causes core dump yes ?
you add fprintf and maybe initialise some memmory then reference it by mistake, this could be answer m ? check address you reference, and addresses you allocate with memmory

this for date ? :) and it should be very portable
Click Here

you need to modify only pointer "next", do you know what linked list is? If you know then you can draw something that you whant to do with it and then program this behaviour

can you try this ? or strtol, please say if works

while(fscanf(f,"%d",&value) == 1)
{
/* do something with the value */
}

you are not the first nor the last who needs to read from file, search google, good luck to you :)

http://www.cplusplus.com/reference/clibrary/cstdio/fopen/

maybe you can use this
http://www.cplusplus.com/reference/clibrary/cstdlib/strtol/

#include <stdlib.h>

int main()
{
   char *pEnd;
   printf("%ld\n",strtol("A",&pEnd,16));
   return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define HOW_MANY_STRUCTS 20
#define MAX_NAME_LENGTH 30
typedef struct ritnish
{
    int iRoll;
    char pcName[MAX_NAME_LENGTH];
}stRitnish;

int main()
{
   stRitnish s[HOW_MANY_STRUCTS] = {0};
   srand(time(NULL));
   memcpy(s[0].pcName, "TestName!",sizeof("TestName!"));
   s[0].iRoll = rand() % 1000;
   printf("Printing name [%s] and number %d\n", s[0].pcName, s[0].iRoll);

   return 0;
}

ok waltp ill do that what is difference between using void main() and int main() because void means it returns empty .but int returns 0

what is empty ?
there is no magic, value is value i suppose

this i wrote for linux what is your platform ? my ubuntu - gcc

#include <time.h>
#include <stdio.h>

int main()
{
   time_t startSeconds;

   startSeconds = time(NULL);

   while(1)
   {
      system("clear");//platform specific check your platform this is linux/unix
      printf("%ld \n", time(NULL) - startSeconds);
      sleep(1);//platform specific check your platform and change this is linux/unix
   }
   return 0;
}

post some example of log file, and what do you expect of it

http://www.cplusplus.com/reference/clibrary/cstdio/scanf/
Return Value
On success, the function returns the number of items successfully read. This count can match the expected number of readings or fewer, even zero, if a matching failure happens.
In the case of an input failure before any data could be successfully read, EOF is returned.

this is what it means fifth is null terminator 065 in oct is '5' check ascii table

#include <stdio.h>

int main()
{
   char str[]="S\065AB";
   char strSame[5] = { 'S','\065', 'A', 'B', '\0'};

   printf("str 1 %d \n", sizeof(str));
   printf("str 2 %d\n", sizeof(strSame));
   printf("same ? %d [%s] [%s]",strcmp(str, strSame),str, strSame);   

   return 0;
}
Ancient Dragon commented: nice :) +14

float is 8 bytes and int 4 bytes if you say %f you expect 8 bytes and type float

#include <stdio.h>

int main()
{
   int iInt = 1;

   printf("int %d float %f",iInt, (float)iInt);
   return 0;
}

btw i suggest you read char buffer in and then convert it to float or int

or something like that

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char *safe_gets(char *buf, size_t size)
{
    if (!fgets(buf, size, stdin))
        return NULL;

    buf[strcspn(buf, "\n")] = '\0';

    return buf;
}

int main(void)
{
    char str[7] = {0};
    int i, k = 0;
    int iLen = 0;
    printf("Enter string 1: ");
    fflush(stdout);

    if (!safe_gets(str, sizeof str)) {
        fprintf(stderr, "Input error\n");
        return EXIT_FAILURE;
    }

    printf("Enter string 2: ");
    fflush(stdout);
    iLen = strlen(str);
    if (!safe_gets(&str[iLen], sizeof str - iLen)) {
        fprintf(stderr, "Input error\n");
        return EXIT_FAILURE;
    }

    printf("\n%s\n", str);

    return EXIT_SUCCESS;
}

take a look at this Click Here

int a[]={1,2,3,4,5,6,7,8,9,10};

You allocate memmory on stack here and a points to that memmory.
Then pointer b points to that memmory location b=a
i mean now b and a point to same location so you can work with it same as with a

here you can try to print it's addresses to check :)

#include <stdio.h>

int main()
{
   char pcArray[3] = {0};
   char *pcToArray = pcArray;
   printf("pcArray == %x and pcToArray == %x",pcArray,pcToArray);
   return 0;
}