UncleLeroy 49 Junior Poster in Training

At line 10, the struct has only one character reserved for the name
which does not make sense, especially with the terminating null character.
Line 35 creates an integer called "name", and line 74 puts an arbitrary number of characters into the address pointed to by that integer. This should crash.

Try using array of char: char name[101];
and then write the code to put no more than 100 characters in it.

UncleLeroy 49 Junior Poster in Training

Mis-using the ternary operator is bad coding practice; the : and ? should be logically similar, for it to be a reasonable thing to do. How about this:

if (i%2 == 0)
    continue;
  cout << i << endl;

There does not need to be an else or ? after a continue, break, or return.
Putting each statement on a separate line makes it easy to single-step through the code in the debugger.

UncleLeroy 49 Junior Poster in Training

The compiler should have warned you about using an uninitialized variable ("head" is used at line 15 but was not set). Perhaps there is an option to enable warnings?
Line 12 needs to be:

char *head = line;
UncleLeroy 49 Junior Poster in Training

See next post

UncleLeroy 49 Junior Poster in Training

Your problem sounds like a homework assignment
from an introductory programming class,
if so, getting the code from the internet would be cheating,

I don't think this forum was intended for that purpose.

Hiz....
Can anyone help me in getting a code for reading a file in C language and counting different characters in it and then make a histogram based on the obtained results....................................plz help :)

UncleLeroy 49 Junior Poster in Training

From "man gcc" (which you should have on your computer)
-ggdb
Produce debugging information for use by GDB. This means to use
the most expressive format available (DWARF 2, stabs, or the
native format if neither of those are supported), including GDB
extensions if at all possible.

I can't explain the warnings, since I can't see them.

hi
when I use this with my program i have msg tell me about the warning in my program
please any one explain it
thanks