Skip to main content

C programming lanuage part- 2

   HOW TO WRITE A SIMPLE C PROGRAM

                   c programming language - Part 1 You learned the history of C and some of its basics. In this section I hope to explain to you how to write a simple c program.




Like other computer languages, C has several unique symbols. Without them, a c program cannot run correctly.Now let's learn about functions in c. The content is presented more simply and clearly so you can read more easily.


 Functions of c programming.

Here, it is difficult to present all the functions of C language to you. Because there are many functions in C language. However, some of them and their brief explanation are given below.


-printf(): used to print output to the console

-scanf(): used to read input from the console

-strlen(): used to find the length of a string

-strcpy(): used to copy one string to another

-strcmp(): used to compare two strings

-malloc(): used to allocate memory dynamically

-free(): used to deallocate memory

-exit(): used to terminate a program

-rand(): used to generate random numbers

-time(): used to get the current time

-strlen() - calculates the length of a string.

-strcat() - concatenates two strings.

-strcmp() - compares two strings.

-isalpha() - checks whether a given character is an alphabetic character.

-isdigit() - checks whether a given character is a digit.

-toupper() - converts a given character to uppercase.

-tolower() - converts a given character to lowercase.

-pow() - calculates the power of a given number.

-sqrt() - calculates the square root of a given number.

-rand() - generates a random number.

-time() - returns the current time in seconds.

-abs() - returns the absolute value of a given number.

-exit() - terminates the program.

-fopen() - opens a file for reading or writing.

-fclose() - closes a file.

-fprintf() - writes formatted output to a file.

-fscanf() - reads formatted input from a file.

-memset() - sets a block of memory to a specific value.

-memcpy() - copies a block of memory from one location to another.

-strstr() - searches a string for a substring.







 Now let's examine how to write a simple c program...


Here the header file should be entered first.


Eg- #include <stdio.h>

       #include<conio.h>

etc. can be seen in various ways.


As the second step, the main function should be added here.


Eg- void main()

       int main()

Here should be presented using parentheses.


Now study the following simple example. For that, you should go to codeblocks or an online c compiler application, paste this part there and check the functionality.

 #include<stdio.h>

int main()

{

    char name[100];


    printf("Enter your name here :");

    gets(name);


    printf("Your name is : %s", name);

    return 0;

}



OUTPUT


                                                    ask to enter the name :




Enter my name :





Final result :




              Thus, C program is unique among computer languages. It can also be seen how other languages ​​have been inspired in some way. However, you can get the most out of it by gaining a broad understanding of the C language. Especially when learning computer languages, learning C first will be helpful for learning other languages ​​like Java. Today you have the opportunity to learn this language for free by using the internet.


Another extension of this will be brought in the future.



Thank you.

Have a nice day..



Your code is : 772823TCL

Comments

  1. Thank you..please give me a post how to use arrays in c..❤️

    ReplyDelete
  2. i was finding that type of solution thanks

    ReplyDelete

Post a Comment

Popular posts from this blog

The Future of Virtual Reality in Education

                  The Future of Virtual Reality in Education             The world of technology is changing day by day. Accordingly, these technical devices and tools can be used for many fields including education and health. Accordingly, this section contains an important article for you related to the educational sector.                  Virtual fact (VR) has turn out to be increasingly more popular in latest years, and it is now poised to revolutionize the way we research and teach. Using VR in schooling remains in its early degrees, however it has the ability to seriously beautify the gaining knowledge of revel in. On this blog post, we will explore the future of virtual truth in training and the way it could rework the manner we examine.    Digital reality is a laptop-generated simulation of 3-dimensional surroundings that can be skilled through a...

FUTURE JOB INDUSTRY

               FUTURE JOB INDUSTRY  This post will help you to understand the "Future Job Industry"        The world of work has undergone significant transformations over the past few decades, driven by rapid advancements in technology, globalization, and shifting societal dynamics. As we step into the future, the job industry is poised for a profound metamorphosis, promising new opportunities and challenges for the global workforce. In this ever-evolving landscape, key trends are shaping the way we perceive work, the skills required, and the industries that will dominate in the years to come. Technology Pioneering:             The future job industry is undoubtedly intertwined with cutting-edge technology. With the advent of artificial intelligence, machine learning, and automation, a range of industries is set to undergo substantial changes. From manufacturing to healthcare, from finance to...

Robotic Process Automation (RPA)

     Robotic Process Automation  ( RPA )                Robotic procedure Automation (RPA) is a unexpectedly growing generation that entails the usage of software robots or bots to automate repetitive and mundane duties in a business technique. It has the potential to revolutionize the manner organizations work and might notably boom their operational performance, lessen expenses, and beautify client enjoy.    RPA technology enables the introduction of software program robots which can mimic human actions, inclusive of navigating pc systems, logging into applications, and acting obligations based on pre-defined rules and situations. Those robots can paintings 24/7 with none breaks or errors and can cope with a giant quantity of statistics in a fraction of the time it takes for human beings to perform the equal responsibilities.    The use of RPA has grow to be an increasing number of usual in numerous indust...