Day 02: Exercise 02 Printing literature

A good first program 

Hii from Team(S.A.O.P)
Remember as i told you have to spent a good amount of time for doing practice...and Don't copy past the below code type it by yourself

lets start with first program

open notepad and type the below code and save it with name "firstcode.c"

program:

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

int main()
{
printf("hello world! \n");
printf("hello again! \n");
printf("I am June \n");
printf("I am 124 yr old \n");
printf("I am writing my first C Program..");
printf("i am dem happy \n");
printf("WOW its working");
return 0;
}

it will look something like this:

then open "cmd" and type the following commands

g++ -c firstcode.c
g++ firstcode.o -o final
.\final

output:


note: open cmd in right drive where you saved you program file..
or else you can do is hold shift-key and right click on your folder and click on "open command window here" and then type above commands..
In the end of this blog you get some link related to below literature if you would like to study more about these topic

what is #include<stdio.h>?

IN C there is command called "#include" it will add/include the appropriate header file in your program before compiling...
"stdio.h" stand for standard input output..It contains some standard functions related to input and output such as "printf", "scanf" here in above code we
used "printf" for displaying text on our command line or we can say cmd..

what is stdlib.h?

stdlib.h stand for "standard library"..which includes functions involving memory allocation, process control, conversions and others.

main() function

In C, the "main" function is treated the same as every function, it has a return type(int main,void main)
The only difference is that the main function is "called" by the operating system when the user runs the program(at the run time of execution).
in c programming main is like starting and ending point of program

printf

Printf is a predefined function in "stdio.h" header file, by using this function, we can print the data or user defined message on console or monitor. While working with printf(), it can take any number of arguments but first argument must be within the double cotes (" ") and every argument should separated with comma ( , ) Within the double cotes ,whatever we pass, it prints same, if any format specifies are there, then that copy the type of value.The scientific name of the monitor is called console.


Facebook link: teamS.A.O.P
video link will be issued in shortly

                                                                                   by teamS.A.O.P and team127.0.0.1isHeaven 

Comments