"Hello programmers" program with a full explanation In this, we are going display  Hello programmers using C language   ...

Hello programmers program with full explaination

/
0 Comments
"Hello programmers" program with a full explanation


  • In this, we are going display  Hello programmers using C language


     #include <stdio.h> // include information about standard

   void  main() //define a function called main that received no argument values
 {

    printf("Hello Programmers\n"); //statements of main are enclosed in braces  main calls library                                                                 //function printf to print this sequence of characters } \n represents                                                         //the newline character
   
    }

What is #include<stdio.h> ?

  •  There is two thing 1st #include<> and stdio.h .#include<> is used to import pre-defined library . Importing important because without importing or including library we cannot use function and variable of that predefine class. And stdio.h is predefined library it contains important function like printf and scanf.
  • #include<stdio.h>  tells the compiler to include information about the standard input/output library; the line appears at the beginning of many C source files.

  • Theory:

  • The standard library is not part of the C language proper, but an environment that supports standard C will provide the function declarations and type and macro definitions of this library. We have omitted a few functions that are of limited utility or easily synthesized from others; we have omitted multibyte characters, and we have omitted discussion of locale issues; that is, properties that depend on local language, nationality, or culture. 
  • The functions, types, and macros of the standard library are declared in standard headers:
  • <assert .h> < float.h> <ctype . h> < limits .h> <errno .h> < locale . h> <stdio.h> <stdlib.h> <string.h> <time .h> <assert .h> < float.h> <ctype . h> < limits .h> <errno.h> < locale.h>
            A header can be accessed by # include <...> 
  • The input and output functions, types, and macros defined in represent nearly one-third of the library. A stream is a source or destination of data that may be associated with a disk or other peripheral. The library supports text streams and binary streams, although on some systems, notably UNIX, these are identical. A text stream is a sequence of lines; each line has zero or more characters and is terminated by '\n'. An environment may need to convert a text stream to or from some other representation (such as mapping '\n' to carriage return and linefeed). A binary stream is a sequence of unprocessed bytes that record internal data, with the property that if it is written, then read back on the same system, it will compare equal. A stream is connected to a file or device by opening it; the connection is broken by closing the stream. Opening a file returns a pointer to an object of type FILE, which records whatever information is necessary to control the stream. We will use ``file pointer'' and ``stream'' interchangeably when there is no ambiguity. 

What is void main()?

  • Void main is a function. And it is the main part of C program. The code which is written in the main block ("code") only that code will execute. Because compiler only executes the main() function.One more thing you should remember circular bracket ( ) means it is a function.And code should be written in {.....}.
  • The statements of a function are enclosed in braces { }. 
  • The function main contains only one statement, printf("hello, world\n"); A function is called by naming it, followed by a parenthesized list of arguments, so this calls the function printf with the argument "hello, world\n". printf is a library function that prints output, in this case, the string of characters between the quotes. A sequence of characters in double quotes, like "hello, world\n", is called a character string or string constant. For the moment our only use of character strings will be as arguments for printf and other functions. The sequence \n in the string is C notation for the newline character, which when printed advances the output to the left margin on the next line. If you leave out the \n (a worthwhile experiment), you will find that there is no line advance after the output is printed. You must use \n to include a newline character in the printf argument; if you try something like printf("Hello, programmers");
  • the C compiler will produce an error message.  printf("Hello Programmers"); Printf ( ) predefine function and it is used to display any Message.That message should be written in "..code.." if it is not it won't write in the colon it not show display anything


  • printf never supplies a newline character automatically, so several calls may be used to build up an output line in stages. Our first program could just as well have been written. 
  • Notice that \n represents only a single character. An escape sequence like \n provides a general and extensible mechanism for representing hard-to-type or invisible characters. Among the others that C provides are \t for the tab, \b for backspace, \" for the double quote and \\ for the backslash itself. 
  • syntax is

           printf("wr");

          ; it is terminating sign. it means instruction is completed and line is ended

Output:-


 For any kind of the query, doubt, And Error live message in cybersquad App. You will get full-time support.I will reply back within an hour.

No comments:

Cybercry 2018. Powered by Blogger.

Popular Posts