Skip to content

visrm/C-Assignments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

License: MIT CodeFactor

C

Table of Contents

Introduction to C

  • C is a procedural programming language.
  • It was initially developed by Dennis Ritchie in the year 1972.
  • It was mainly developed as a system programming language to write an operating system.
  • The main features of the C language include :
    • low-level memory access
    • simple set of keywords
    • clean style
      these features make C language suitable for system programmings like an operating system or compiler development.
  • Many later languages have borrowed syntax/features directly or indirectly from the C language
    • Like syntax of Java, PHP, JavaScript, and many other languages are mainly based on the C language.
    • C++ is nearly a superset of C language (Few programs may compile in C, but not in C++).

For more information on C , click here

Sections of the C Program

There are 6 basic sections responsible for the proper execution of a program. Sections are mentioned below:

  1. Documentation
  2. Preprocessor Section
  3. Definition
  4. Global Declaration
  5. Main() Function
  6. Sub Programs

main() Function

main is a predefined keyword or function in C. It is the first function of every C program that is responsible for starting the execution and termination of the program. It is a special function that always starts executing code from the main having int or void as return data type.

For more information of the following, click here

example program:

// Documentation 
/**                      
 * file: sum.c 

 * author: xyz 

 * description: program to find sum. 

 **/

  
// Link 
#include <stdio.h>       

  
// Definition 
#define X 20  

  
// Global Declaration 

int sum(int y);    

  
// Main() Function 

int main(void)        
{ 

  int y = 55; 

  printf("Sum: %d", sum(y)); 

  return 0; 
} 

  
// Subprogram 

int sum(int y)  
{ 

  return y + X; 
}

Basic C Glossary

These are glossary for some of the keywords, functions and terms used in this programs :

Header Files

In C language, header files contain the set of predefined standard library functions. The “#include” preprocessing directive is used to include the header files with “.h” extension in the program. Here is the table that displays some of the header files used in the programs:

Header files Description Example of contained functions
stdio.h Input/Ouput functions printf();, scanf();
conio.h Console Input/Output functions getch();, clrscr();
stdlib.h General utility functions malloc();, realloc();
math.h Mathematics fuctions sqrt();, pow();
string.h String functions strcpy();, strcmp();

Preprocessor

In C programming, the preprocessor is a behind-the-scenes program that acts on your code before it reaches the actual compiler. It's like a prep cook getting everything ready for the main chef (the compiler)

Compiler

In C programming, the compiler plays a critical role in converting your human-readable code into instructions the computer can understand.

Comments

Comments in C are essential elements that enhance code readability and maintainability. They are annotations or explanations added to the source code, but are ignored by the compiler during compilation.

Pointers

Pointers are special variables that store memory addresses of other variables. Imagine your variables live in different houses on a street. A pointer holds the address (like a house number) of another variable on that street.

List of Programs

The list of Programs are divided into two parts .

PART-1

Program Status
Check for leap years.
Find roots of quadratic equation.
Find sum of digits and reverse of number.
Display pyramid using "*". ✅️
Find factorial of a number.
To find first n prime numbers.
Find LCM & HCF of two numbers.
To display count of -ve's, +ve's, zeroes in a set of N numbers.
To print Armstrong number within range. ✅️
To covert decimal number to new base.
To calculate standard deviation of N numbers. ✅️
Find decimal equivalent of number(base other than 10). ✅️
To merge two arrays.
To sort n numbers.
To find Nth fibonacci number.
To find the trace of a square matrix.
Find the number of words in a given sentence. ✅️
Find the number of vowels in strings. ✅️

For further informations on the programs click here

PART-2

Program Status
Sort a given list of strings.
Merge two sorted arrays into one sorted array.
Search an element in one dimensional array using linear search.
Search an element in one dimensional array using binary search.
Implement sparse matrix.
Create a singly linked list of N nodes and display it.
Delete a given node (by position) from a singly linked list.
Create a singly linked list and search an element from that list.
Implement polynomial using array.
Implement stack operations (push & pop) using array.
Implement queue operations (insertion & deletion) using array.
Implement merge sort using array.
Implement bubble sort using array.
Implement selection sort using array.
Implement insertion sort using array.

For further informations on the programs click here

Contributing guide

🎉🎉 we welcome all contributors to contribute to this repository. For more information on terms of contributions, click here.         

About

Contains a list of basic C programs for uni cs purpose .

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors

Languages