Subject: Grant processing

From: Federal Student Grants <[email-masked]>
Date: Thu, 12 Feb 2015 08:25:41 -0800

[Related Deadlines 2015]
Processing Deadline: 2/12/2015 (PELL Grants)

Dear Ietf-dkim-archive

We are currently processing aid/grants for students who are planning on going back to school.

Unlike aid grants do not have to be repaid.
http://www.usastudentfinansystems.com/valance/ohmmeters/choosier/fivers/angels.htm

Note: Once grants are depleted they will no longer be available, it is in your best interest to check your status today.

Regards,
Education EDU Processing

(Accessible Grants : As of today)
http://www.usastudentfinansystems.com/valance/ohmmeters/choosier/fivers/angels.htm

http://www.grants.gov/web/grants/home.html

This is an automated messages delivery system. All information should not be forwarded or shared. If you were sent this message on error please delete it. If you would like end communication with out alert service use this URL (http://www.usastudentfinansystems.com/shard/tonicity/caustics.php) or use this address to write: Eight Robbins Road Arlington MA 02476. Thank you, and have a great day.

which book is this?   Shikhar Bhardwaj Feb 2 at 11:46

The book is: amazon.co.uk/Tour-C--Depth/dp/0321958314/   Andy Res Feb 2 at 11:48
2
Just to expand on these nice answers, you're confusing null pointers (what you're looping is actually checking for) and null terminators (what you want to check for, the character that terminates a C string).  nanny Feb 2 at 14:56

Thank you for pointing it out.   Andy Res Feb 2 at 15:01

I suggest you throw that book in the recycle bin, and curse all 'programmers' who suggest you write cutsie code like that. If you write the code so that the intended meaning is clear - "while (p != NULL)" it's pretty obvious that you're stepping the pointer p through all memory. Instead you want "while (*p != '\0')", checking for a null-terminated string

Your code (while(p)) loops as long as p isn't zero. P is the pointer to the array, and you keep incrementing it and check memory past the array's bounds. That's the cause of the segmentation fault.
share improve this answer
answered Feb 2 at 11:38
zmbq
20.8k 3 25 68
add a comment

up vote2down vote

to my surprise it does not stop there, but it continues to cycle, which I suppose might be the cause of segmentation fault?

This happens because you are checking the pointer for NULL, rather than checking what it points to for '\0':
while(*p){