Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
oorrja
GitHub Repository: oorrja/learntosolveit
Path: blob/master/source/cprogramming/Ex_1.7_eofval.rst
1241 views
===========================
Exercise 1.7 - Value of EOF
===========================

Question
--------

Write a Program to print the value of EOF.

Solution
--------

.. literalinclude:: ../../languages/cprogs/Ex_1.7_eofval.c
   :language: c
   :tab-width: 2

.. runcode:: ../../languages/cprogs/Ex_1.7_eofval.c
   :language: c
   :codesite: ideone

Explanation
===========

1. Since EOF is an integer, we can print it with %d format in the printf. 2. EOF
value is printed as -1.



.. seealso::

   * :c-suggest-improve:`Ex_1.7_eofval.c`
   * :c-better-explain:`Ex_1.7_eofval.rst`